Solutions Sample Overview

The Visual FoxPro Solutions sample is a collection of independent samples designed to illustrate particular features of Visual FoxPro. As you go through these samples, you can see how to accomplish specific tasks in Visual FoxPro.

To run the Solutions Sample application

  • Enter the following in the Command window:
    DO (HOME(2) + 'solution\solution')

    – Or –

  1. From the Program menu, choose Do.

  2. Choose the …\Samples\Vfp98\Solution folder.

  3. Double-click Solution.app.

The samples are organized into the following categories: ActiveX, Controls, Databases, Forms, Foundation Classes, Menus, New Features for VFP 6.0, Reports, Toolbars, and Windows API. When you select a component, you can:

  • Read a brief description of the sample in the description area at the bottom of the main Solutions form.

  • Run the sample by choosing Run Sample.

  • See the code by choosing See Code.

After you close the form or designer that is opened, you are returned to the main Solutions form.

How the Solutions Sample Works

Each component of the Solutions sample is listed in Solution.dbf. This table stores the following:

  • The key and parent key ids required to add nodes to a treeview control.

  • The image id in the ImageList control for the picture to be displayed beside the item in the treeview control.

  • The file name and path of the components.

  • The method to open when you choose See Code.

  • The description to be displayed in the Visual FoxPro Solutions form.

There are two additional tables used to provide filtered list access to the components: Xref.dbf and Reftext.dbf.

The FillTree method of the Solution.scx reads the information from Solution.dbf to fill the treeview control.

* FillTree
o = THIS.pgf1.pagTree.oleTree

SCAN
   IF ALLTRIM(parent) = '0'
      oNode = o.nodes.add(,1,ALLTRIM(key),ALLTRIM(text),,)
   ELSE
      oNode = o.nodes.add(ALLTRIM(parent),4,ALLTRIM(key), ALLTRIM(text),,)
   ENDIF
   * add images to the treeview
   IF !empty(image)
      oNode.Image = ALLTRIM(image)
   ENDIF
ENDSCAN

Forms

Each form in the Solutions suite contains an object based on the c_solutions class in Solution.vcx. This class provides a single place for environment and localization settings. When the c_solutions object is destroyed, old settings are restored and, if the Solutions form exists, it is redisplayed.

The custom class is used in the Solutions sample because it provides greater flexibility: you can add it to existing forms, and, if you want, you can delete it from the forms in the Solutions suite and customize the forms for your own use. Instead of using a custom class to manage the environment settings, you can provide this functionality in one form class from which all forms in the Solutions sample are derived.

Form records in Solution.dbf have a value of "F" stored to the type field. In the code associated with cmdRun and cmdSee, the form is run or modified.

* extract from cmdRun.Click
   CASE solutions.type = "F" && form
      DO FORM (ALLTRIM(solutions.path) + "\" + ALLTRIM(solutions.file))

Note In the Data Environment of Solution.scx, the cursor for Solution.dbf is given an alias of "Solutions."

Reports and Queries

Report records in Solution.dbf have a value of "R" stored to the type field, and queries have a type of "Q". You can run the reports and queries in the code associated with cmdRun, and you can modify them in the code associated with cmdSee.

* extract from cmdRun
   CASE solutions.type = "R" && report
      REPORT FORM (ALLTRIM(solutions.path) + "\" + ALLTRIM(solutions.file)) PREVIEW NOCONSOLE
      THISFORM.Visible = .T.

Running a query opens the result set in a Browse window. By default, a Browse is displayed in the currently active window, which in this sample would be the Solutions form. To display the Browse in a separate window, this code defines and activates another window, runs the query, and then releases the separate window.

   CASE solutions.type = "Q" && query
      #DEFINE TITLE_LOC "Results of query "
      DEFINE WINDOW brow_wind FROM 1,1 TO 30, 100 TITLE TITLE_LOC + UPPER(ALLTRIM(file))+ ".QPR " ;
         FLOAT GROW MINIMIZE ZOOM CLOSE FONT "Arial",10
      ACTIVATE WINDOW brow_wind NOSHOW
      DO (ALLTRIM(solutions.path) + "\" + ALLTRIM(solutions.file) + ".QPR")
      RELEASE WINDOW brow_wind
      THISFORM.Visible = .T.
ENDCASE


Add and Remove Items in a Treeview Control

File: ...\Samples\Vfp98\Solution\OLE\Bldtree.scx

A treeview control displays a collection of Node objects, each of which consists of a label and an optional bitmap. After creating a treeview control, you can add, remove, arrange, and otherwise manipulate Node objects by setting properties and invoking methods.

This sample illustrates adding nodes to a treeview control, deleting nodes, selecting nodes programmatically, writing a treeview hierarchy to a table, and reading a treeview hierarchy from a table.

Adding Nodes

Each node in a treeview control needs to have a unique key that is a character string, generated by the NewKey method in this sample form.

*NewKey method
cKey = THIS.cNextKey
THIS.cNextKey = ALLTRIM(STR(VAL(THIS.cNextKey) + 1) + "_")
RETURN cKey

The Add method of the treeview control is used to add new nodes. The code associated with the Click event of cmdNewNode adds a root level node using the Add method.

o = THISFORM.oleTree
o.Nodes.Add(,1,THISFORM.NewKey(),"Click to edit text",0)

The code associated with the Click event of cmdNewChild adds a node as a child of the currently selected node.

o = THISFORM.oleTree
IF !ISNULL(o.SelectedItem) THEN
   o.Nodes.Add(o.SelectedItem.Key, 4, THISFORM.NewKey(), "Click to edit text",0)
ENDIF

Deleting Nodes

You can delete all of the nodes by calling the Clear method.

THISFORM.oleTree.Nodes.Clear

Or you can use the Remove method to delete selected nodes. All children of the deleted node are also deleted.

THISFORM.oleTree.Nodes.Remove(THISFORM.oleTree.SelectedItem.Key)

Writing and Reading Hierarchies in Tables

To save your treeview hierarchy in a table so you can reload it and edit it, loop through all the nodes in the treeview control and write the Key, the parent node's Key, and the Text to the appropriate fields of a table.

FOR i = 1 TO loNodes.Count
   IF ISNULL(loNodes.Item(i).Parent)
      lcParent = "0_" && Root
   ELSE
      lcParent = loNodes.Item(i).Parent.Key
   ENDIF
   INSERT INTO (lcDBFName) VALUES ;
      (loNodes.Item(i).Key, ;
       lcParent, ;
       loNodes.Item(i).Text)
ENDFOR

To reconstruct the treeview hierarchy, scan through the records in the table, using the parent key, key, and text values that you previously stored.

* Fill the TreeView control with values in the table.
o = THISFORM.oleTree.Nodes
   SCAN
      IF ALLTRIM(parent) = '0_'
         o.add(,1,ALLTRIM(key),ALLTRIM(text),0)
      ELSE
         o.add(ALLTRIM(parent),4,ALLTRIM(key), ALLTRIM(text),0)
      ENDIF
      THISFORM.cNextKey = ALLTRIM(STR(VAL(key) + 1) + "_")
   ENDSCAN


Use the RichText Control

File: ...\Samples\Vfp98\Solution\OLE\Rtf.scx

This sample illustrates using a RichText control to display and edit RTF text stored in the memo field of a table.

You can set the ControlSource of a RichText control directly to a character field, but not a memo field. Instead, create a form property to mediate between the RichText control and the memo field.

To store RTF text in a memo field

  1. Set the ControlSource property of the RichText control to the form property.
    THISFORM.oleRTF.ControlSource = THISFORM.cText
  2. Store the memo field contents to the form property.
    THISFORM.cText = rtf.source
  3. Before moving the record pointer, store the TextRTF property of the RichText control to the memo field.
    REPLACE rtf.Source WITH THISFORM.oleRTF.TextRTF

The text stored in the memo file is standard RTF format, for example:

{\rtf1\ansi\deff0\deftab720{\fonttbl{\f0\fswiss MS Sans Serif;}{\f1\froman\fcharset2 Symbol;}{\f2\fswiss Arial;}{\f3\fswiss Arial;}} {\colortbl\red0\green0\blue0;\red255\green0\blue0;} \deflang1033\pard\qc\plain\f3\fs32\i The RichTextBox Control \par \pard\plain\f3\fs20


Provide a Hierarchical Display of Items

File: ...\Samples\Vfp98\Solution\OLE\Outline.scx

This sample shows two different types of ActiveX controls which you can use for outlining. In this sample, a directory structure is displayed. A custom method on the form named FillTree is called recursively to iterate through the entire tree structure.

The Outline control can be used for simple outlining, however, it does not offer the Windows 95 shell look available with the Treeview control. In addition, the Treeview control also allows display of images with each node.

Outline Control

You can add items to the outline control with the AddItem method. Indentation is handled through the Indent method which takes an index number representing the item to affect.

THIS.PageFrame1.Page1.OleOutline.AddItem(LOWER(m.path))
THIS.PageFrame1.Page1.OleOutline.Indent(m.cnt-1)= m.lvl

Treeview Control

The new Treeview control can give your applications a truly genuine Windows 95 look. Unlike the Outline control which uses methods and item indexes, the Treeview control uses a Nodes collection.

Note To display images in a treeview control, you must add an ImageList control to the form.

* Add items to treeview control
o = THIS.PageFrame1.Page2.oleTreeview
IF cnt = 1
   oNode = o.nodes.add(,1,LOWER(m.path)+"_",LOWER(m.path),,)
   oNode.Image = "world"   &&name of image
ELSE
   oNode = o.nodes.add(m.pkey,4,LOWER(m.path)+"_",LOWER(m.path),,)
   oNode.Image = "fldr"   &&name of image
ENDIF


Use Slider and Status Bar Controls

File: ...\Samples\Vfp98\Solution\OLE\Slider.scx

This sample illustrates using the Slider control and the StatusBar control.

Slider Controls

Code in the Scroll event of each slider control sets the Value property of the other controls.

#DEFINE TXT_LOC "slider value: "
THISFORM.Olecontrol2.Panels(2).Text = TXT_LOC + ALLTRIM(STR(THIS.value))
THIS.Parent.spn1.Value = THIS.Value
THIS.Parent.oleV.Value = THIS.Value

StatusBar Control

The StatusBar Control Properties dialog box makes setting status bar properties easy.

To open the StatusBar Control Properties dialog, choose StatusBar Control Properties from the shortcut menu of a StatusBar Control.


Send Mail

File: ...\Samples\Vfp98\Solution\OLE\Sendmail.scx

This sample illustrates using the mailbtn class in ...\Samples\Vfp98\Classes\Buttons.vcx to create a simple messaging form that can send Visual FoxPro data to an e-mail address.

Mailbtn is a container class that contains a command button and two ActiveX controls: MAPI Session and MAPI Messages, both of which are defined in Msmapi32.ocx. The MAPI Session control establishes a MAPI session, and the MAPI Messages control allows the user to perform a variety of messaging system functions.

The mailbtn class starts a new Mail session, collects data from the current record, and brings up the Send Mail dialog with the data inserted as the message text.

This class includes two custom methods AddTabs and StripPath for formatting the information gathered from the table and inserted in the mail message.

This class also takes advantage of another custom method called Signon as well as a custom property called logsession, which is set to .F. initially.

When the user clicks the cmdMail button, the following code in the Click event calls the signon method, setting logsession to true (.T.).:

this.logsession = .T.
this.OLEMSess.signon

If there is a failure on signon, the Error event of the class is called and logsession is set to .F.

The MAPI controls are invisible at run time. In addition, there are no events for the controls. To use them, you must specify the appropriate methods. For these controls to work, MAPI services must be present. MAPI services are provided in Microsoft Mail and Exchange electronic mail systems for Microsoft Windows version 3.0 or later.


Display System Information

File: ...\Samples\Vfp98\Solution\OLE\Sysinfo.scx

This sample illustrates using the SysInfoControl to display system information and to notify when a system setting changes.

The bulk of the code in this sample is in the CheckStatus method. Code in this method checks the settings of various SysInfoControl properties to see their current settings, and populates a treeview control with this information. For example, the following section of code checks the BatteryLifePercent setting:

IF ThisForm.SysInfo.BatteryLifePercent = 255
   * Add a node to display the information
ENDIF

When a system setting changes, an event of the SysInfoControl occurs. Code associated with each of these events sets the caption of a label and calls the CheckStatus method to refresh the treeview control. For example, the following code is associated with the SysColorsChanged event:

ThisForm.Status.Caption = SysColorsChanged_LOC
ThisForm.CheckStatus


Customize the Open Dialog Box

File: ...\Samples\Vfp98\Solution\OLE\Commdlog.scx

This sample illustrates customizing the appearance and behavior of the Open dialog box as exposed through the Common Dialog control.

You can set the Flags property of the Common Dialog control to specify the behavior of the Open dialog box. For a list of the various Flags values, see Open Dialog Box Flag Values.

The following code in the Click event of cmdFiles checks the values of the various check boxes on the form and sets the Flags property of the Common Dialog control.

Set the Read-only check box flag

IF !thisform.chkRead.Value
   m.nFlags = m.nFlags + 4
ENDIF

Set the Multiple files flag

IF thisform.chkMulti.Value
   m.nFlags = m.nFlags + 512
ENDIF

Set the Help button flag

IF thisform.chkHelp.Value
   m.nFlags = m.nFlags + 16
ENDIF

Set the enforce file existence flag

IF thisform.chkMulti.Value
   m.nFlags = m.nFlags + 4096
ENDIF

Set the Flags property of the Common Dialog control

thisform.oleCommDlog.Flags = m.nFlags

Set the Filter property of the Common Dialog control

You can use the Filter property of the Common Dialog control to specify what files a user is allowed to choose.

thisform.oleCommDlog.Filter = "All files" + ;
   "(*.*)|*.*|Text (*.txt)|*.txt" + ;
   "|Pictures(*.bmp;*.ico)|*.bmp;*.ico"


Manipulate Display Characteristics of a Graph

File: ...\Samples\Vfp98\Solution\OLE\Olegraph.scx

This sample shows how to incorporate MS Graph into your applications. MS Graph ships with Visual FoxPro and can also be included in your distributed applications. MS Graph 5.0 is an Automation server that Visual FoxPro can automate using the standard CREATEOBJECT( ) function. With Visual FoxPro, Graph objects can be embedded in either bound or unbound OLE Controls. An OleBoundControl (bound to a General field) is the only way to programmatically insert data into a graph.

MS Graph's automation support provides access only to a graph object, not its datasheet. Data can be inserted into a Graph only with the APPEND GENERAL command on a General field. The following code uses the HasLegend property and is an example of automation:

cGData = ""+TAB+"Cats"+TAB+"Dogs"+CRLF+;
      "1994"+TAB+"11"+TAB+"22"+CRLF+;
      "1995"+TAB+"33"+TAB+"44"+CRLF+;
      "1996"+TAB+"55"+TAB+"55"+CRLF
APPEND GENERAL gen1 CLASS "msgraph.chart" DATA m.cGData
THIS.OleBoundControl1.ControlSource = "Gen1"
THIS.OleBoundControl1.HasLegend = .F.

The APPEND GENERAL command in this case creates a new chart object. If you do not include the CLASS "msgraph.chart" clause, then the chart is merely updated. The CLASS clause will create a new chart and override any existing formatting.


Automate a Microsoft Excel Spreadsheet

File: ...\Samples\Vfp98\Solution\OLE\Olexl.scx

This form shows two samples of Visual FoxPro calling an Excel worksheet through automation.

The Trend button performs a query followed by a cross-tab to create a dataset to pass to Excel through automation using the Excel.Sheet object. Once in Excel, Visual FoxPro can call a Trend function to perform a simple regression analysis.

The Chart button automates the Excel.Chart object to create a chart. Excel supports passing data through automation, but MS Graph does not. However, you can distribute MS Graph with your applications.


Automate a Microsoft Word Document in a Form

File: ...\Samples\Vfp98\Solution\OLE\Oleword.scx

This sample shows how you can automate an embedded Word object on a form, insert some rich text, and then format the text. Typical automation with Word is usually done via the "Word.Basic" object used interactively with a CREATEOBJECT( ) function.

oForm = THISFORM
oForm.AddObject('oWordDoc','OleControl','WordDocument')
oForm.oWordDoc.Visible =  .t.
oForm.oWordDoc.DoVerb(0)


Refresh a Graph in a Form

File: ...\Samples\Vfp98\Solution\OLE\Stock.scx

This sample illustrates selecting data from a table and passing it to MS Graph to refresh the values in a chart. Most of the code to do this is associated with the InteractiveChange event of the cboMonth combo box.

Select the data into a cursor

SELECT date, close;
  FROM Stock1 WHERE MONTH(date) = THIS.Value ;
  ORDER BY date INTO CURSOR wtemp

Create a character string containing the selected data

SELECT wtemp

lcData = " " + TAB + "Closing Price" + CRLF

SCAN
 lcData = lcData + DTOC(date)
 lcData = lcData + TAB
 lcData = lcData + ALLTRIM(STR(close)) + CRLF
ENDSCAN

Send the character string to MS Graph

SELECT Graph
APPEND GENERAL msgraph DATA lcData


Automate Microsoft Word and Excel

File: ...\Samples\Vfp98\Solution\OLE\Oleaut1.scx

This is a simple sample showing Visual FoxPro as an Automation controller. It demonstrates how to select data from a Visual FoxPro database, place the data in a Microsoft Excel worksheet, graph the data using Chart, and then display the graph in Word. To use this sample, you need at least Excel 5.0, Word 6.0, and Testdata.dbc, located in the ...\Samples\Vfp98\Data directory.

The following line of code creates a reference to a Microsoft Excel spreadsheet.

objXLsheet=createobject("Excel.Sheet")

The following line of code adds a chart to the spreadsheet.

objChart1 = objXLsheet.ChartObjects.Add(100, 100, 200, 200)

The following line of code creates a reference to Microsoft Word.

objWDdoc=createobject("word.basic")

oWordRef = GetObject('','word.basic')


Edit a Memo Field or Text File

File: ...\Samples\Vfp98\Solution\Controls\TXT_EDT\Editbox.scx

This sample enables you to view and edit text from a memo field or a text file in an edit box.

Displaying text from a memo field is as easy as setting the ControlSource of the edit box to the memo field.

There are two ways you can edit a text file in an edit box: using low-level file functions and creating a cursor to hold the text. This sample creates a cursor instead of using low-level file functions.

Editing a Text File with Low-Level File Functions.

You can open a file using FOPEN( ), read the contents of the file using FREAD( ), and store the contents to a memory variable or to the Value property of the edit box. You can then write changes to the file using FWRITE( ) and close the file using FCLOSE( ).

Editing a Text File by Loading It into a Cursor Field

The advantage to creating a cursor for a text file, other than the fact that the code is a little simpler, is that Visual FoxPro manages writing large amounts of text in a cursor to temporary files if there isn't enough memory.

IF SELECT("textfile") = 0
   CREATE CURSOR textfile (filename c(60),mem m)
   APPEND BLANK
ENDIF
REPLACE textfile.FileName WITH GETFILE("TXT")
IF EMPTY(textfile.FileName)
   RETURN
ENDIF

SELECT textfile
APPEND MEMO mem FROM (textfile.FileName) OVERWRITE
THIS.Parent.edtText.ControlSource = "textfile.mem"
THIS.Parent.cmdSave.Enabled = .T.
THIS.Parent.lblFileName.Caption = ALLTRIM(textfile.FileName)
THIS.Parent.Refresh


Programmatically Manipulate Text

File: ...\Samples\Vfp98\Solution\Controls\TXT_EDT\Text.txt

This sample illustrates using the SelStart, SelLength, and SelText properties of an edit box to manipulate the text at run time. The sample also counts the characters, words, and paragraphs in a text file and allows a user to search for a string in a text file.

Formatting Text

The following code is included in the Click event of the button that formats selected text to uppercase:

lo = THIS.Parent.edtText
lnOldStart = lo.SelStart
lnOldLength = lo.SelLength

lo.SelText = UPPER(lo.SelText)

lo.SelStart = lnOldStart
lo.SelLength = lnOldLength

If you want to specify the font attributes of selected sections of text, use a RichText control.

Searching for Text

After getting the text to search for, the following code loops through all the text in the edit box, comparing it to the target string:

llKeepLooking = .T.
DO WHILE llKeepLooking
  FOR i = lnStart TO LEN(loEDT.Value)
    loEDT.SelStart = i
     loEDT.SelLength = lnLen
    IF loEDT.SelText = ALLTRIM(loCBO.Text) OR ;
         (!llCaseSensitive AND ;
         (UPPER(loEDT.SelText) = UPPER(ALLTRIM(loCBO.Text))))
      llFound = .T.
      llKeepLooking = .F.
      EXIT
    ENDIF
  ENDFOR

  IF !llFound
    lnChoice=MESSAGEBOX("Search string not found.", ;
        64+0+4)
    IF lnChoice = 6 && Yes
      llKeepLooking = .T.
      lnStart = 0
    ELSE
      llKeepLooking = .F.
    ENDIF
  ENDIF
ENDDO

Tip Be sure to set the form's LockScreen property to true (.T.) before searching and false (.F.) after searching. Otherwise, the form will repaint every time the SelStart property of the edit box is changed.


Display Calculated Values in a Column

File: ...\Samples\Vfp98\Solution\Controls\Grid\Calc.scx

This sample illustrates how to display a calculated value in a column.

Set the ControlSource property of the column to an expression with a calculation. For example, the following expression for the ControlSource of the Profit column displays the difference between the price and cost.

Products.Unit_Price - Products.Unit_Cost

When you change one or more values in the expression, the value in the column is automatically updated.

Note Columns that display an expression containing a calculation are read-only.


Display Controls in a Grid

File: ...\Samples\Vfp98\Solution\Controls\Grid\Controls.scx

This sample demonstrates controls displayed in grid columns.

You can add controls to a column in the Form Designer by selecting a column and adding a control, or programmatically with the AddObject method.

There are a few properties that are important for displaying controls in a column.

CurrentControl Property

After you add a control to a grid column, you need to set the column's CurrentControl property to the new control for the new control to be displayed.

Sparse Property

The check boxes on the form allow you to toggle the Sparse property of the grid columns that contain controls. When Sparse is set to .T., the control is only displayed when the focus is on a cell in the column. When Sparse is set to .F., the control is always displayed in each cell in the column.

Controls and Events

Notice that the control in the column processes the events when you set the focus to a cell in the column. For example, if you select a cell in a column with a spinner, when you press the up and down arrows, you increment or decrement the value in the spinner. This is the default behavior for a spinner, not the default behavior for a text box in a grid cell.

For a more detailed description of adding controls to grid columns, see Chapter 10, "Using Controls," in the Programmer's Guide.


Dynamically Format Grid Columns

File: ...\Samples\Vfp98\Solution\Controls\Grid\Dyngrid.scx

This sample illustrates setting the DynamicForeColor and DynamicBackColor properties of grid columns.

The code of interest in this sample is associated with the InteractiveChange event of the drop-down list cboFormat.

First, the code clears the dynamic fore and backcolor settings:

oGrd.SetAll("dynamicbackcolor", "", "Column")
oGrd.SetAll("dynamicforecolor", "", "Column")

Then, code in a CASE statement sets the new DynamicForeColor or DynamicBackColor properties. For example, the following line of code displays discontinued items with a gray ForeColor.

oGrd.SetAll("dynamicforecolor", ;
   "IIF(discontinu, RGB(192,192,192), RGB(0,0,0))", "Column")

Discontinu is a logical field in the Products table.


Display Child Records from a Relationship

File: ...\Samples\Vfp98\Solution\Controls\Grid\1_many.scx

This sample demonstrates coordinating a 1-to-many form with two grids displaying the many sides of the relationships. Very little code is needed in this sample. Setting a few properties is all that is involved.

Property Settings

Text boxes for the "one" side of the relationship:

ControlSource = Customer.cust_id
ControlSource = Customer.company

Grid for the first "many" side of the relationship:

ChildOrder = cust_id
LinkMaster = customer
RecordSource = orders
RecordSourceType = 1 - Alias
RelationalExpr = customer.cust_id
ColumnCount = 4
   Column1.ControlSource = "orders.order_no"
   Column1.Header1.Caption = "Order"
   Column2.ControlSource = "orders.order_date"
   Column2.Header1.Caption = "Date"
   Column3.ControlSource = "orders.to_name"
   Column3.Header1.Caption = "Ship To"
   Column4.ControlSource = "orders.order_amt"
   Column4.Sparse = .F.
   Column4.Header1.Caption = "Total"
   Column4.Text1.InputMask = "$$999,999.99"

Grid for the 2nd "many" side of the relationship:

ChildOrder = order_id
LinkMaster = Orders
RecordSource = Orditems
RecordSourceType = 1 - Alias
RelationalExpr =Orders.order_id
ColumnCount = 4
   Column1.ControlSource = "orditems.line_no"
   Column1.Header1.Caption = "Item"
   Column2.ControlSource = "products.prod_name"
   Column2.Header1.Caption = "Product"
   Column3.ControlSource = "orditems.quantity"
   Column3.Header1.Caption = "Qty."
   Column4.ControlSource = "orditems.unit_price"
   Column4.Sparse = .F.
   Column4.Header1.Caption = "Price"
   Column4.Text1.InputMask = "$$9,999.99"

In addition to the text boxes and the grids, the form contains an object based on the VCR class in Buttons.vcx. The SkipTable property of this class is set to the table you want the record pointer to be moved in when the user chooses a table navigation button. Because the user can easily manually move through the records in the grids (Orders and Orditems), SkipTable is set to Customer.


Add Items Interactively to a List Box

File: ...\Samples\Vfp98\Solution\Controls\Lists\Ladd.scx

This sample demonstrates adding and removing list box items. When a user types text in the text box and presses ENTER, the text in the text box is added to the list and the cursor is returned to the text box so that the user can enter another value.

To allow a user to interactively add items to a list, use the AddItem method. In the sample, the following code in the text box KeyPress event adds the text in the text box to the list box and clears the text box when the user presses ENTER:

PARAMETERS nKeyCode, nShiftCtrlAlt
IF nKeyCode = 13     && Enter Key
   THISFORM.lstAdd.AddItem (This.Value)
   THIS.Value = ""
ENDIF

The following code in the DblClick event of the list box removes the item that was double-clicked, sending the value to the text box:

THISFORM.txtAddText.Value = This.List(This.ListIndex)
THIS.RemoveItem (This.ListIndex)


Display Multiple Columns in a List Box

File: ...\Samples\Vfp98\Solution\Controls\Lists\Lmulcol.scx

This sample demonstrates displaying multiple columns in a list box. The form displayed contains a list box and a spinner. The number of columns in the list box is set to the Value property of the spinner: 1, 2, 3, or 4.

To set the width of the columns in a multi-column list box, use the ColumnWidths property. For example, if there are 3 columns in the list box, the following command will set the column widths to 10, 15, and 20, respectively:

Form.List.ColumnWidths = "10, 15, 20"

To set the fields to be displayed in the columns, set the RowSource property. For example, the following command sets the sources of three columns in a 3-column list box to the contact, city, and country fields of the customer table:

Form.List.RowSource = "contact,city,country"

The ColumnLines property determines whether lines are displayed between the columns in the list.


Move Items Between List Boxes

File: ...\Samples\Vfp98\Solution\Controls\Lists\Lmover.scx

This sample demonstrates moving items from one list box to another. A user can double-click one item to move it, select one or more items and drag them, or use the appropriate command buttons to move the items between the lists.

The two list boxes and four associated command buttons are saved as a class: MoverLists in Samples.vcx. The base class of MoverLists is CONTAINER. To be able to add and remove items from lists, the RowSourceType of the lists must be set to 0 – None. If you want to fill the list box with array elements or values from a table, you can use code like the following:

*array
FOR i = 1 to ALEN(myarray)
   List.AddItem(myarray[i])
ENDFOR

*table
SCAN
   List.AddItem(table.field)
ENDSCAN

To Move Items by Double-Clicking

The following code is associated with the DblClick event of the left list box (lstSource). Similar code is associated with the DblClick event of the right list box (lstSelected).

THIS.Parent.lstSelected.AddItem(THIS.List(THIS.ListIndex))
This.RemoveItem(THIS.ListIndex)
THIS.Parent.Refresh

"THIS" refers to lstSource. "THIS.Parent" refers to the moverlists class, the container of the lists.

To Move All Items from One List to Another

The following code is associated with the Click event of cmdAddAll:

  DO WHILE THIS.PARENT.lstSource.ListCount > 0
    THIS.PARENT.lstSelected.AddItem;
        (THIS.PARENT.lstSource.List(1))
   THIS.PARENT.lstSource.RemoveItem(1)
  ENDDO
  THIS.PARENT.Refresh

To Move Selected Items from One List to Another

If you remove an item from a list box, the ListCount property of the list box is decremented, as is the ListIndex of all the subsequent items in the list. To move multiply selected items, you need to use a DO WHILE loop. The following code is associated with the Click event of cmdAdd:

nCnt = 1
DO WHILE nCnt <= THIS.PARENT.lstSource.ListCount
   IF THIS.PARENT.lstSource.Selected(nCnt)
      THIS.PARENT.lstSelected.AddItem;
         (THIS.PARENT.lstSource.List(nCnt))
      THIS.PARENT.lstSource.RemoveItem(nCnt)
   ELSE
      nCnt = nCnt + 1
   ENDIF
ENDDO
THIS.PARENT.Refresh

To Drag and Drop Items from One List to Another

Implementing drag-and-drop between the list boxes involves code associated with the MouseDown, MouseMove, DragOver, and DragDrop events. Three user-defined properties (DragThreshold, MouseX, and MouseY) extend the usability of the class.

The MouseDown code stores the X and Y coordinates of the mouse pointer to class properties.

*MouseDown
Parameters nButton, nShift, nXCoord, nYCoord
THIS.PARENT.MouseX = nXCoord
THIS.PARENT.MouseY = nYCoord

The MouseMove code makes sure the left mouse button is pressed before initiating the drag procedure. In addition, to guard against accidental dragging, this code checks to make sure that the user has moved the mouse a distance greater than a set threshold (8 pixels by default).

*MouseMove
Parameters nButton, nShift, nXCoord, nYCoord
IF nButton = 1 && Left Mouse
   IF ABS(nXCoord - THIS.PARENT.MouseX) > ;
      THIS.Parent.DragThreshold OR ;
         ABS(nYCoord - THIS.PARENT.MouseY) > ;
         THIS.Parent.DragThreshold
      THIS.Drag
   ENDIF
ENDIF

The DragOver code changes the DragIcon of the source when the mouse pointer enters and leaves the list box "air space."

*DragOver
Parameters oSource, nXCoord, nYCoord, nState
DO CASE
   CASE nState = 0 && Enter
      oSource.DragIcon = THIS.Parent.CanDropIcon
   CASE nState = 1 && Leave
      oSource.DragIcon = THIS.Parent.NoDropIcon
ENDCASE

The DragDrop code makes sure that the source of the drag is not the same as the target of the drag and calls the method associated with the Click event of the cmdAdd command button (in the case of lstSelected) or cmdRemove (in the case of lstSource).

*DragDrop
Parameters oSource, nXCoord, nYCoord
IF oSource.Name != THIS.Name
   THIS.PARENT.cmdAdd.Click
ENDIF


Multiselect Items in a List Box

File: ...\Samples\Vfp98\Solution\Controls\Lists\Lmsel.scx

This sample shows how to manage multiple items selected in a list box. The form contains a list box with the MultiSelect property set to True (.T.). A combo box on the form contains all the items that are selected in the list box.

To process the multiple-selected items in a list box — to copy them to an array or incorporate them elsewhere in your application — loop through the list items and process the ones for which the Selected property is set to true (.T.). The following code is included in the Click event of the list box to display the selected items in a combo box and the number of selected items in a text box:

nNoSelected = 0    && variable to track number of selected items
THISFORM.cboSelected.Clear    && clear the combo box

* main processing loop
FOR i = 1 TO THIS.ListCount
   IF THIS.Selected(i)
      nNoSelected = nNoSelected + 1
      THISFORM.cboSelected.Additem (THIS.List(i))
   ENDIF
ENDFOR

THISFORM.txtNoSelected.Value = nNoSelected

In the code associated with the Init event of this form, and in many places throughout this sample application, the character string values initially added to the list are first defined with a #DEFINE directive. Each of the defined constants ends with "_LOC". Microsoft internal localization tools extract these definitions so that the strings can be translated into whatever language the application is being localized in.


Open Multiple Files Interactively

File: ...\Samples\Vfp98\Solution\Controls\Lists\Multfile.scx

This sample shows how to populate a list with files. When you populate a list with files, built-in functionality allows a user to select new drives and directories. In this sample, a user can select one or more files in the list and open them for editing.

The following code loops through the items in the list box and opens the selected files for editing:

FOR nFile = 5 to THISFORM.lstFiles.ListCount
   IF THISFORM.lstFiles.Selected(nFile)
      MODIFY FILE (THISFORM.lstFiles.List(2) + ;
         THISFORM.lstFiles.List(nFile)) NOWAIT
   ENDIF
ENDFOR

When the RowSourceType property is set to 7 - Files:

  • lstFiles.List(1) refers to the drive.

  • lstFiles.List(2) refers to the path.

  • lstFiles.List(3) is a separator line.

  • lstFiles.List(4) is [..]. Click to go to the parent directory.

Files can start at lstFiles.List(5)


Sort List Box Items

File: ...\Samples\Vfp98\Solution\Controls\Lists\Lsort.scx

This sample demonstrates allowing a user to rearrange or sort the items in a list. The key properties to set are:

   List.MoverBars = .T.
   List.Sorted = .T.

Set the MoverBars property to true (.T.) to allow a user to reorder an item in the list by dragging the button to the left of the item to the new position.

Set the Sorted property to true (.T.) to display the list items in alphabetical order. You can still rearrange the items in the list after they have been sorted. Set the Sorted property to .T. again to sort the list in alphabetical order again.

The Sorted property applies only if the RowSourceType property of the list is set to 0 (None) or 1 (Value).


Fill a List with Values from Different Sources

File: ...\Samples\Vfp98\Solution\Controls\Lists\Multdat1.scx

This sample demonstrates setting the RowSourceType of a list box at run time to a value, an alias, a SQL statement, a query (.qpr), an array, fields in a table, files in a directory, and the structure of a table.

The combo box on the form contains all the possible RowSourceTypes of a list (except for 9 - popup, which is included for backward compatibility). The code associated with the InteractiveChange event sets the new RowSourceType and RowSource properties for the list.

When you change both the RowSourceType and RowSource of a list box at run time, you need to do the following:

  1. Set the RowSourceType to 0.

  2. Set the RowSource to the new source.

  3. Set the RowSourceType to the new type.

If you don't follow this order, the existing RowSource and RowSourceType settings could conflict after one new value is set and before the corresponding value is set.


Display Pictures in a List

File: ...\Samples\Vfp98\Solution\Lists\Piclist.scx

This sample illustrates how you can spice up your list boxes by adding picture graphics beside the individual text items. In this sample, you can pick any database (.dbc) file, and the list box will show different images beside the names of tables, local views and remote views.

The following code from cmdDatabase.Click enumerates through a .dbc and selectively adds pictures to list items using the Picture property. The Picture property relies on an index setting to determine which list item to affect.

FOR i = (m.nTblCount+1) TO thisform.lstDatabase.ListCount
IF DBGETPROP(ALLTRIM(thisform.lstDatabase.List[m.i]),; "view","sourcetype") = 1
       *Local view
      thisform.lstDatabase.Picture[m.i] = m.cLViewBMP
   ELSE
      * Remote view
      thisform.lstDatabase.Picture[m.i] = m.cRViewBMP
   ENDIF
ENDFOR

Note You need to ensure that the images used are sized correctly to fit within the space of a single list box item, which differs with the FontSize of the list.


Present a User with Multiple Choices

File: ...\Samples\Vfp98\Solution\Controls\Buttons\Quiz.scx

This sample illustrates using an option button group with no default selection and binding a character field to the option group.

To display an option group with no selected button, do one of the following:

  • Set the Value property of each of the option buttons in the group to 0 of .F.

  • Set the Value property of the option button group to 0.

To store the caption of option buttons to a table field

  • Set the ControlSource of the option button group to the field.


Change Pages When a User Chooses a Button

File: ...\Samples\Vfp98\Solution\Controls\Pageframe\Msgbox

This sample allows you to interactively construct a message box.

There are six command button combinations possible in a message box. Each of these combinations is displayed on a separate page in a page frame on the Messagebox Builder form.

The option buttons, labeled 0 through 5, allow you to specify which combination of command buttons you want to be displayed in your message box. The selected button in the page indicates the default Messagebox button selection. The ActivePage property of the page frame is set to the Value of the Option group.

Constructing the MESSAGEBOX Code

In the InteractiveChange event of the controls on the form, the WriteCode method of the form is called to dynamically construct the MESSAGEBOX code.

* WriteCode Method
#DEFINE QM '"'

cString = '=MESSAGEBOX('
cString = cString + QM + ALLTRIM(STRTRAN(THIS.edtMessage.Value, CHR(13)+CHR(10), QM + '+CHR(13)+' + QM)) + QM + ','
cString = cString + THIS.cboIcon.Value + '+'
cString = cString + THIS.DefaultButton + '+'
cString = cString + ALLTRIM(STR(THIS.opgButtons.Value - 1)) + ','
cString = cString + QM + ALLTRIM(THIS.txtCaption.Value) + QM + ')'

THIS.edtCode.Value = cString


Change the Number of Tabs at Run Time

File: ...\Samples\Vfp98\Solution\Pgframe\Pfsam1.scx

This sample illustrates using a page frame with tabs. The number of tabs changes dynamically when a user chooses a new value in a spinner. When the user selects a tab, a list box displays values specific to the tab.

To change the number of tabs at run time

  • Set the PageCount property to the desired number of pages.

The list box in this sample is positioned on the form, not on any of the pages in the page frame. This placement allows you to have a single control visible in all of your pages.

Two user-defined form methods set the captions on the tabs and make sure the values in the list box match: UpdateList and SetCaption.

UpdateList Method

UpdateList is called when the number of tabs changes and when the user selects a new tab.

LOCAL lnPage, lcHigh, lcLow
#define NO_MATCH_LOC 'No Matching Names for '
DIMENSION THISFORM.aCustomers[1,2]
lnPage = THISFORM.pgfRolodex.activepage
THISFORM.aCustomers[1,1] = NO_MATCH_LOC + ;
   THISFORM.pgfRolodex.Pages(lnPage).Caption
THISFORM.aCustomers[1,2] = ""

lcHigh = substr(THISFORM.pgfrolodex.Pages(lnPage).caption,3,1)
lcLow = substr(THISFORM.pgfrolodex.Pages(lnPage).caption,1,1)
SELECT company, phone FROM customer;
   WHERE company <= lcHigh and company => lcLow;
   ORDER BY company;
   INTO ARRAY THISFORM.aCustomers

THISFORM.lstCustomers.Requery
THISFORM.lstCustomers.Value = 1

SetCaption Method

SetCaption is called in the spinner's UpClick and DownClick events to calculate what captions should appear on the tabs.

THISFORM.LockScreen = .T.
FOR n = 1 to THISFORM.pgfRolodex.PageCount
   FirstLetter = SUBSTR(THISFORM.Alphabet,((n - 1)*ROUND(LEN(THISFORM.Alphabet)/THISFORM.pgfRolodex.PageCount,0))+1,1)
   IF n = THISFORM.pgfRolodex.PageCount   &&last page
      LastLetter = right(THISFORM.Alphabet,1)
   ELSE
      LastLetter = SUBSTR(THISFORM.Alphabet,((n)*ROUND(LEN(THISFORM.Alphabet)/THISFORM.pgfRolodex.PageCount,0)),1)
   ENDIF
   THISFORM.pgfRolodex.Pages(n).Caption = FirstLetter + "-" + LastLetter
ENDFOR
THISFORM.LockScreen = .F.

Alphabet is a user-defined form property that is used to determine the captions for each tab. To get the same functionality in different languages, set the Alphabet property to a string containing all the letters in the target language alphabet.


Display Different Pages Without Tabs

File: ...\Samples\Vfp98\Solution\Controls\Pgframe\Pfsam2.scx

This sample demonstrates manipulating pages without tabs in a form page. The frame in the middle of the form contains three pages that are brought to the front as the user chooses command buttons. Each page can have its own controls and appearance.

The method that brings a particular page to the front is ZOrder. For example, the following line of code in the click event of one of the command buttons brings pagCustomers to the front:

THISFORM.pgfPeople.pagCustomers.ZOrder

You can also use the ActivePage property of the page frame to determine which pages are displayed.

THISFORM.pgfPeople.ActivePage = 1


Format Input and Validate Data in a Text Box

File: ...\Samples\Vfp98\Solution\Controls\TXT_EDIT\Textbox.scx

This sample shows how to set text box properties to make it easy for a user to enter data in the required format.

Format | Property | Setting
Allow Only Digits | InputMask | 999999999
Select On Entry | SelectOnEntry | .T.
All Uppercase Format !
Read-Only | ReadOnly | .T.
US Telephone Number | InputMask | (999) 999-9999
Password text PasswordChar
*
Date Formatting | DateFormat | a number between 0 and 14

Validating Input

The following code in the Valid event of a text box prevents a user from leaving the text box if the letter "a" is in the text:

IF "a"$ THIS.Value
   #DEFINE MESSAGE_LOC "The text box value cannot contain the letter 'a'"
   MESSAGEBOX(MESSAGE_LOC,48+0+0)
   RETURN 0
ELSE
   RETURN .T.
ENDIF


Display a Stop Watch

File: ...\Samples\Vfp98\Solution\Controls\Timer\Swatch.scx

This sample includes the Stopwatch class (described in Chapter 3, "Object-Oriented Programming," in the Programmer's Guide).

The Stopwatch Class

The Stopwatch class includes a timer and several display labels. The Timer increments numeric custom properties of the class and sets the Caption property of the labels accordingly.

The Start method of the class sets the Enabled property of the Timer to true (.T.). The Stop method sets the Enabled property of the Timer to false (.F.). And the Reset method sets the numeric properties to 0.

The Swatch Form

The Swatch form contains an object derived from the Stopwatch class, along with some command buttons. The code written for the Click event of the first command button on the form calls the Start and Stop methods of the Stopwatch class. The second button calls the Reset method of the Stopwatch class.


Display a System Clock

File: ...\Samples\Vfp98\Solution\Controls\Timer\Clock.scx

This sample contains the Clock custom control in Samples.vcx on a form. The class includes a text box for displaying the date and time and a timer for updating the display.

The TimeFormat property of the clock class can be set to 0 for 24-hour time format or 1 for 12-hour format. The code in the Timer event of the timer updates the time.

#DEFINE LONGDATE_LOC CDOW(DATE())+" "+CMONTH(DATE())+" "+ ;
         ALLTRIM(STR(DAY(DATE())))+", "+ALLTRIM(STR(YEAR(DATE())))

IF This.Parent.TimeFormat = 0
   This.Parent.txtTime.Value = IIF(VAL(SUBSTR(TIME(),1,2))>12, ;
      ALLTRIM(STR((VAL(SUBSTR(TIME(),1,2))-12)))+SUBSTR(TIME(),3,6),TIME())
ELSE
   This.Parent.txtTime.Value = TIME()
ENDIF

THIS.Parent.txtDate.Value = LONGDATE_LOC

This class contains a separate text box for date and time values. If you want to hide one or the other, you can easily set its Visible property to false (.F.). An easier way to display the time and date is to use a single text box and set the value of this text box in a timer control to DATETIME( ). This will allow you to take advantage of the Hours, Seconds, and DateFormat properties of a text box.


Execute Commands at Specified Intervals

File: ...\Samples\Vfp98\Solution\Controls\Timer\Timecomm.scx

This sample form contains a text box and a spinner. Text you type in the text box is displayed in a WAIT WINDOW. You can set the spinner to the number of seconds you want to elapse between each WAIT WINDOW command.

In the InteractiveChange event of the spinner, the appropriate timer interval is set. The Interval property is 1/1000th of a second, so the interval is set to the spinner value * 1000.

THISFORM.Timer1.Interval = (THIS.Value * 1000)

In the Timer event, the WAIT WINDOW command is issued.

WAIT WINDOW ALLTRIM(THISFORM.Text1.Value) TIMEOUT 0.5

The code associated with the Timer event can include any command or procedure: code to update data, check for mail, display system resources, and so on.


See Command Button Design Options

File: ...\Samples\Vfp98\Solution\Controls\Buttons\Cmdbtn.scx

This sample illustrates a variety of properties that can be set to customize command button display.

Property | Description
Cancel | The Click event code of the command button with Cancel set to true (.T.) is executed when a user presses ESC.
Default | The Click event code of the command button with Default set to true (.T.) is executed when a user presses ENTER.
Picture | Bitmap displayed if Style is Graphical.


See Check Box Design Options

File: ...\Samples\Vfp98\Solution\Controls\Checkbox\Checkbox.scx

This sample illustrates a variety of properties that can be set to customize check box display.

Property | Description
ControlSource | A variable or table field that is numeric or logical.
Picture | Bitmap displayed if Style is Graphical.
Style | Graphical for pictures or standard for a box.
Value | .T., .F., 0, 1, 2, or .NULL.


Add New Items to a Combo Box

File: ...\Samples\Vfp98\Solution\Controls\Combobox\Lookup.scx

This sample illustrates adding user-entered text to a combo box drop-down and providing lookup capability.

Adding User Text to a Combo Box Drop-Down

A combo box allows a user to enter text or select an item from a drop-down list. You can also add the text a user types in the combo box as a new item in the drop-down list so the user won't have to type the same text multiple times.

There are multiple ways to add user text to the drop-down list of a combo box, depending on the RowSourceType property setting of the combo box. In this sample, the RowSourceType of the combo boxes is 1 - Value. If the value the user enters isn't already in the drop-down list for cboCombo, the following code adds a comma and the new value to the RowSource:

cCountryName = ALLTRIM(Custs.Country)
IF ATC(m.cCountryName,THIS.RowSource)=0 AND !EMPTY(m.cCountryName)
   THIS.RowSource=THIS.RowSource+","+m.cCountryName
ENDIF

The combo box in the Programmatically Manipulate Text example has a RowSourceType of 0 - None. The following code in the Valid event of cboSearchString in ...\Samples\Vfp98\Solution\Controls\TXT_EDT\Text.scx adds a user-entered value to the drop-down list of the combo box:

IF !EMPTY(THIS.Text)
   FOR i = 1 TO THIS.ListCount
      IF THIS.List(i) = THIS.Text
         RETURN
      ENDIF
   ENDFOR
   THIS.AddItem(THIS.Text)
ENDIF

If the RowSource of the combo box is an array, you need to add the user text to the array and call the Requery method of the combo box.

If the RowSource is a table or a cursor, you need to add a record, REPLACE the blank field with the user-entered value and Requery the combo box.

Provide Lookup Capability

In addition to illustrating how to add items to a combo box, this sample demonstrates three ways of allowing a user to filter a table for particular values. A user can do the following:

  • Enter values in a combo box.

  • Select an item from a drop-down list.

  • Enter partial values in a combo box for incremental search.

Enter Values in a Combo Box

The key code is associated with the LostFocus event of cboCombo. After making sure that the user has entered a value, the LostFocus code selects the records that match the user's text and sets the RecordSource property of the grid to the result set.

cDisplayValue = ALLTRIM(THIS.DisplayValue)

IF THIS.Value = "(All)"
   SELECT country AS location,* FROM CUSTOMER;
      INTO CURSOR Custs
   thisform.grdcust.recordsource = "Custs"
ELSE
   SELECT country AS location,* FROM CUSTOMER ;
    WHERE UPPER(ALLTRIM(Customer.Country)) = UPPER(m.cDisplayValue);
    INTO CURSOR Custs
   THISFORM.grdCust.RecordSource = "Custs"
ENDIF

Select an Item from a Drop-down List

Basically the same lookup code is associated with the InteractiveChange event of cboDrop – if the Value of the combo box is "(All)", select all records into the cursor, otherwise, select the records that match the user's choice.

Enter Partial Values for Incremental Search

Code in the InteractiveChange event of cboIntSearch performs the lookup every time the user types a character in the combo box.

#DEFINE DELKEY 127
LPARAMETERS nKeyCode, nShiftAltCtrl
LOCAL cDisplayValue
IF nKeyCode = DELKEY
   cDisplayValue = ALLTRIM(THIS.DisplayValue)
   IF LEN(m.cDisplayValue)=1
      cDisplayValue = ""
   ELSE
      cDisplayValue = LEFT(cDisplayValue,LEN(cDisplayValue)-1)
   ENDIF
ELSE
   cDisplayValue = ALLTRIM(THIS.DisplayValue)+CHR(nKeyCode)
ENDIF

THISFORM.LockScreen = .T.
DO CASE
CASE EMPTY(m.cDisplayValue)
   THISFORM.grdcust.recordsource = " "
CASE THIS.Value = "(All)"
   SELECT country AS location,* FROM CUSTOMER;
      INTO CURSOR Custs
   thisform.grdcust.recordsource = "Custs"
OTHERWISE
   SELECT country AS location,* FROM CUSTOMER ;
    WHERE UPPER(ALLTRIM(Customer.Country)) = UPPER(m.cDisplayValue);
    INTO CURSOR Custs
   thisform.grdcust.recordsource = "Custs"
ENDCASE
THISFORM.ResetCombos(THIS)
THISFORM.LockScreen = .F.


Allow Users to Choose List Values

File: ...\Samples\Vfp98\Solution\Forms\Datalook.scx

This sample illustrates providing users with a set of values, selected from another table, in a list box and in a drop-down list box. The value the user chooses is stored in the current table.

It is often more convenient for a user to choose from a list of predetermined values, and, of course, you minimize the risk that the user will mistype a value. Setting a few list box properties is all that is required to provide this capability. For example, the following properties were set for cboEmp_id on the Using Combo Box page:

Property | Setting
BoundColumn | 2
ColumnCount | 2
ControlSource | orders.emp_id
RowSource | SELECT DISTINCT ALLTRIM( employee.first_name) + " " + ALLTRIM( employee.last_name) , EMP_ID FROM employee INTO CURSOR cEmpCombo ORDER BY first_name
RowSourceType | 3 – SQL Statement

Rather than having the user choose an employee id number from the drop-down list, the SELECT statement allows you to show the user the employees' first and last names.

Because the SELECT statement creates a cursor, code in the Destroy event closes the cursor.

IF USED("cEmpCombo") THEN
   USE IN cEmpCombo
ENDIF


Resize and Reposition Controls at Run Time

File: ...\Samples\Vfp98\Solution\Forms\Cresize.scx

A user can resize this sample form as desired. The controls on the form are resized or repositioned relative to the new Height and Width properties of the form.

This form uses the resizable class in ...\Samples\Vfp98\Classes\Samples.vcx to manage resizing and repositioning of the controls. The following line of code is added to the Resize event of the form, calling the AdjustControls method of the resizable class:

THIS.Resizable2.AdjustControls

In the Init of the resizable class, code loops through all the controls in the form, storing their positions and sizes relative to the form in an array. When the form is resized, the AdjustControls method resizes and repositions the controls to their relative sizes and positions.

You can add more controls to the form and the new controls will also be resized and repositioned.

The RepositionList and ResizeList properties contain a space-delimited list of all the classes that you want to reposition and resize. If you don't want a certain class to be resized, remove it from the ResizeList.

You can prevent a user from making the form too small for the objects contained on it by setting the form's MinHeight and MinWidth properties.


Allow Users to Drag and Drop Controls

File: ...\Samples\Vfp98\Solution\Forms\Ddrop.scx

This sample explains how to implement drag and drop operations. One page on the form illustrates manual dragging of controls by calling the Drag method. Explicitly calling the Drag method allows you to process other code in the Click event of the control. The other page illustrates using the Automatic DragMode setting so that the Drag and Drop operation is started automatically when the user presses the mouse button over the controls.

Repositioning the Command Button

In the MouseMove event of cmdDrop, if the left mouse button is down, find out how far the mouse pointer is from the top and the left of the command button and begin the drag operation.

LPARAMETERS nButton, nShift, nXCoord, nYCoord
IF nButton = 1 && Left button
   THISFORM.XOffset = nXCoord – THIS.Left
   THISFORM.YOffset = nYCoord - THIS.Top
   THIS.Drag
ENDIF

In the DragDrop event of the page that the command button is on, reposition the command button.

oSource.Left = nXCoord - THISFORM.XOffset
oSource.Top = nYCoord - THISFORM.Yoffset

Changing the Color of the Shape

The DragMode property of the colored squares on the Change Colors page of the form is set to 1 –Automatic. As soon as the user presses the mouse button on the squares, the drag operation begins. Any code added to the Click event of the squares would never be executed.

Code in the DragDrop event of the circle changes its BackColor property to match that of the drag source.

LPARAMETERS oSource, nXCoord, nYCoord
THIS.BackColor = oSource.BackColor


Index on Expressions

File: ...\Samples\Vfp98\Solution\Db\Index2.scx

This index sample shows several options you might consider when using a character field to represent a Unique ID (one often comprised of numeric data). An index tag based on a character field will sort based on the ascii values of the data whereas a numeric expression, using the VAL( ) function, will sort on numeric sequences. The following table shows the sort difference of two indexes:

Cexpression | VAL(cExpression
1 | 1
11 | 2
2 | 11

Note When you use the VAL( ) function, all non-numeric values will be converted to 0.

By incorporating the BINTOC( ) function, you can also reduce the size of your index tags considerably.


Create Small Indexes Using BINTOC( )

File: ...\Samples\Vfp98\Solution\Db\Index1.scx

This sample show various indexing schemes you can use with numeric and integer data types to get significant savings in index size and disk space consumed. In addition, smaller sized indexes usually result in faster searches. The new BINTOC() function allows you to convert an integer (numeric) value to a binary character representation.

Syntax

BINTOC(nExpression [, nSize])

Depending on the size of your expression, you can set the nSize parameter to accommodate the value of your expression in the least amount of characters.

The following line of code creates an index on a numeric field:

INDEX on line_no TAG line_no

The next time you are working with indexes on numeric integer data, consider using something like the following:

INDEX on BINTOC(line_no,1) TAG line_no


Create a Default Unique ID Value for a Field

File: ...\Samples\Vfp98\Solution\Db\Newid.scx

This sample uses a stored procedure in a database to provide a default primary key value.

To create a default unique ID

  1. Add a separate table to the database that stores the next id for each table in the database. The name of this table in the sample is Ids.dbf. It contains two fields: Table C(10), NextID I.

  2. Create a function in the stored procedures of the database to return the next id value from the id table. The name of this function in the sample is NewID. It is listed below.

  3. Set the default value for the field to the function.

NewID Stored Procedure

FUNCTION NewID(tcAlias)
LOCAL lcAlias, lnID, lcOldReprocess, lnOldArea

  lnOldArea = SELECT()

  IF PARAMETERS() < 1
    lcAlias = UPPER(ALIAS())
  ELSE
    lcAlias = UPPER(tcAlias)
  ENDIF

  lcOldReprocess = SET('REPROCESS')

  * Lock until user presses Esc
  SET REPROCESS TO AUTOMATIC

  IF !USED("IDS")
    USE newid!ids IN 0
  ENDIF
  SELECT ids

  IF SEEK(lcAlias, "Ids", "table")
    IF RLOCK()
      lnID = ids.nextid
      REPLACE ids.nextid WITH ids.nextid + 1
      UNLOCK
    ENDIF
  ENDIF

  SELECT (lnOldArea)
  SET REPROCESS TO lcOldReprocess

  RETURN lnID
ENDFUNC


Sort or Order a Table at Run Time

File: ...\Samples\Vfp98\Solution\Db\Order.scx

This sample illustrates changing the order in which records in a table are listed. The customer table has index tags on the fields displayed in the grid. In the MouseUp event of each of the headers in the grid, the order of the table is set to the index tag associated with the field displayed in the column. For example, the following code is associated with the MouseUp event of the Company header:

LPARAMETERS nButton, nShift, nXCoord, nYCoord
IF nShift = 2 && CTRL
   SET ORDER TO Company DESCENDING
ELSE
   SET ORDER TO Company ASCENDING
ENDIF

GO TOP
THISFORM.Refresh


Programmatically Check Table Properties

File: ...\Samples\Vfp98\Solution\Db\Info.scx

This sample illustrates getting information about a table at run time.

Field Information

The AFIELDS( ) function provides most of the information about table fields displayed in this sample. In addition to the information displayed in this sample, AFIELDS( ) provides information about field and table validation expressions and messages, trigger expressions and messages, as well as long table names and table comments in the database.

Index Information

The TAG( ) and KEY( ) functions provide index information.

lo = THISFORM.edtProperties
FOR i = 1 TO 254
   IF !EMPTY(TAG(i))  && Checks for tags in the index
      lo.Value = lo.Value + TAG(i) + "  " + KEY(i)
   ELSE
      EXIT
   ENDIF
ENDFOR


Nest Transactions

File: ...\Samples\Vfp98\Solution\Db\Trans.scx

This sample illustrates beginning, ending, and rolling back transactions. You can decide to commit or discard changes to a single table when you use table buffering, but you can decide to commit or discard changes to any number of tables when you use transactions.

Before editing either table, click the Begin button. After editing, you can click Begin again to nest another transaction, or you can click End to commit your edits to the table or Rollback to discard your changes.

The key commands in this example are as follows:

BEGIN TRANSACTION

END TRANSACTION

ROLLBACK

The function that returns the current number of nested transactions is as follows:

TXNLEVEL( )


Select Records from Both Inner and Outer Joins

File: ...\Samples\Vfp98\Solution\Data\Comboj.qpr

The query, COMBOJ, uses the testdata database, and combines information from the tables, customer, orders, and orditems. Each result record has fields for the company from the customer table, the order_date from the orders table, and the line_no from the orditems table as specified in the SELECT clause of the SELECT-SQL statement.

SELECT Customer.company, Orders.order_id, Orditems.line_no;
 FROM testdata!customer LEFT OUTER JOIN testdata!orders;
    INNER JOIN testdata!orditems ;
   ON Orders.order_id = Orditems.order_id ;
   ON Customer.cust_id = Orders.cust_id

The order in which the tables are joined determines the order in which the join conditions are evaluated. In this query, the join between orders and orditems is evaluated first and produces a subset of records that meets the join condition. Because of the inner join, the subset of records has only records from both tables that match the condition. This subset of records is matched to the records in the customer table. Because of the outer join between customer and orders, any customers not having orders also appear in the results and have the value NULL.

Customers without orders are included in the results.

You can change the results of the query by specifying filters, a sort order, group, or other miscellaneous options for the query.


Select Records from a Full Outer Join

File: ...\Samples\Vfp98\Solution\Data\Fouterj.qpr

The query, FOUTERJ, in the Solution project combines information from the country table and the customer table using a full outer join. Each result record has a field for each of the fields from the country table, and the country and cust_id field for the field from the customer table as specified in the SELECT clause of the SELECT-SQL statement.

SELECT Country.*, Customer.country, Customer.cust_id;
 FROM testdata!customer FULL JOIN country ;
  ON Customer.country = Country.country

Typically, a full outer join answers three questions about the records in your database. Some of the questions this query could answer include:

  • Which customers are in which countries?

  • Which countries do not have any of our customers in them?

  • Which customer records are missing country information?

This information might help someone decide if they should expand their business to other countries, change their marketing strategy in some countries, or simply that some records in the database need the country information updated.

The full outer join returns all records from both tables and combines records that match the join condition. The result set includes the following three subsets of records:

  • Records matching the join condition that combine information from a record in each table.

  • Records from the country table that do not match the join condition.

  • Records from the customers table that do not match the join condition.

Because each record in the results has the same fields, the records that did not have a match in the other table have NULL values in the fields that would otherwise hold values from the other table. For example, if a record for the country, Russia, did not have any related customer records in the customer table, that record appears in the results with NULL as the value of the field, cust_id and country_b.

NULL values appear in fields for nonmatching records.

You can change the results of the query by specifying filters, a sort order, group, or other miscellaneous options for the query.


Select Records from an Inner Join

File: ...\Samples\Vfp98\Solution\Data\Innerj.opr

The query, INNERJ, in the Solution project uses the database, TESTDATA, and combines information from the tables, ORDERS and CUSTOMER using an inner join condition. Each result record has fields for the CUST_ID, COMPANY, and COUNTRY from the CUSTOMERS table, and ORDER_ID from the ORDERS table as specified in the SELECT clause of the SELECT-SQL statement.

SELECT Customer.cust_id, Customer.company, Customer.country,;
 Orders.order_id;
 FROM testdata!orders INNER JOIN testdata!customer ;
 ON Orders.cust_id = Customer.cust_id

This query retrieves and combines the records between the two tables that match the join condition. The condition specifies that the records must have the same value in the cust_id field.

The inner join returns only records that match the join condition.

An inner join typically answers one basic question. In this query, the question is what orders did each customer place? If a customer has a record in the database but has not placed an order, the record does not appear in the results because it is not part of the subset that matches the join condition.

You can change the results of the query by specifying filters, a sort order, group, or other miscellaneous options for the query.


Select Records from a Nested Join

File: ...\Samples\Vfp98\Solution\Data\Nested.qpr

The query, nested, in the Solution project combines information from the customer, orders, and orditems tables using two inner join conditions. One join condition is between customer and orders; the other between orders and orditems. Each result record has fields for the cust_id and company from the customers table, order_id from the orders table, and line_no from the orditems table as specified in the SELECT clause of the SELECT-SQL statement.

SELECT Customer.cust_id, Customer.company, Orders.order_id, Orditems.line_no;
 FROM testdata!customer INNER JOIN testdata!orders;
 INNER JOIN testdata!orditems ;
 ON Orders.order_id = Orditems.order_id ;
 ON Customer.cust_id = Orders.cust_id

The order in which the tables are joined determines the order in which the join conditions are evaluated. In this query, the join between orders and orditems is evaluated first and produces a subset of records that meets the join condition. This subset of records is matched to the records in the customer table and produces the final results set.

You can change the results of the query by specifying filters, a sort order, group, or other miscellaneous options for the query.


Select Records from a Right Outer Join

File: ...\Samples\Vfp98\Solution\Data\Routerj.qpr

The query, ROUTERJ, in the Solution project uses the testdata database, and combines information from the orders table and the employee table using a right outer join. Each result record has a field for the order_id from the orders table and for the lastname field from the employee table.

SELECT Orders.order_id, Employee.last_name;
 FROM testdata!employee RIGHT OUTER JOIN testdata!orders ;
 ON Employee.emp_id = Orders.emp_id

Typically, a right outer join can answer two questions about the records in your database. Some of the questions this query could answer include:

  • Which orders were entered by which employees?

  • Which orders do not have an employee specified?

This information may help track specific orders and identify orders that do not have an employee specified as placing the order.

The right outer join retrieves all records from the table on the right of the join condition combined with the records from the table on the left that match the join condition. The results set includes the following two subsets of records:

  • Records matching the join condition that combine information from a record in each table.

  • Records from the orders table that do not match the join condition.

Because each record in the results has the same fields, the records with a lastname that did not have a match in the orders table have NULL values in the field that would otherwise hold values from the orders table. For example, if a record for order number 11078 did not have any related employee records in the employee table, that record appears in the results with the value NULL in the field, lastname.

The record for order 11078 without a matching record in the EMPLOYEE table

You can change the results of the query by specifying filters, sort order, group, or other miscellaneous options for the query.


Select Records from a Left Outer Join

File: ...\Samples\Vfp98\Solution\Data\Louterj.qpr

The query, LOUTERJ, in the Solution project combines information from the orders table and the customer table using a left outer join. Each result record has a field for the order_id from the orders table and for the cust_id, company, country fields from the customer table as specified in the SELECT clause of the SELECT-SQL statement.

SELECT Customer.cust_id, Customer.company, Customer.country,;
 Orders.order_id;
 FROM testdata!orders LEFT OUTER JOIN testdata!customer ;
  ON Orders.cust_id = Customer.cust_id

Typically, a left outer join can answer two questions about the records in your database. Some of the questions this query could answer include:

  • Which orders belong to which customers?

  • Which orders do not have related customer information?

This information helps the database administrator determine which order records are missing information.

The left outer join returns all records from the table on the left of the join condition combined with the records from the table on the right of the condition that match the condition. The results set includes the following two subsets of records:

  • Records matching the join condition that combine information from a record in each table.

  • Records from the orders table that do not match the join condition.

Because each record in the results has the same fields, the records with an order_id that did not have a match in the customer table have NULL values in the fields that would otherwise hold values from the customer table. For example, if the record for order 11079 did not have any related customer records in the customer table, that record appears in the results with the value NULL in the fields, cust_id, company, and country.

The order for 11079 does not have a match for any record in the Customer table.

You can change the results of the query by specifying filters, a sort order, group, or other miscellaneous options for the query.


Interactively Build a SELECT Statement

File: ...\Samples\Vfp98\Solution\Forms\Makesql.scx

This sample shows how to allow a user to build a custom query at run time. Combo boxes on the form allow a user to choose fields from the currently open table. The BldSQL method processes the names of the fields and the values users type into text boxes to create an executable SQL SELECT statement.

Additional methods, ValidateType and SetTextboxFormat, make sure that the appropriate values are entered into the text boxes and correctly incorporated into the SELECT statement.

After the WHERE clause has been constructed and stored to the variable lcWhere, the following command creates the SELECT statement:

lcSQL = "SELECT * FROM " + lcAlias + " " + lcWHERE

Once the SELECT statement is constructed, it can be executed with macro substitution.

&lcSQL


Select Customers in a Specific Country

File: ...\Samples\Vfp98\Solution\Data\Testdata.dbc

This sample illustrates using a parameterized view ("customers in specific country" in the testdata database) to display a subset of records that match a variable set at run time.

To create a parameterized view in the View Designer, enter a variable prefixed with a question mark (?) in the Example box of the Filter tab.

If the variable doesn't exist at run time, the user is prompted to enter a value for the variable, whichcountry in this example. If the variable already exists, the view displays matching records without prompting for a new value.


Select the Top Ten Best Selling Products

Select the Top 10 Best-Selling Products

File: ...\Samples\Vfp98\Solution\Data\Topten.qpr

This query displays the top 10 best-selling products based on sales recorded in the Order Items table. The query uses the TOP n feature of the SELECT statement. Because the order is set to DESCENDING, ordering by the sum of price and quantity returns the 10 highest values.

SELECT TOP 10 Products.prod_name,;
  SUM( Orditems.unit_price*  Orditems.quantity);
 FROM testdata!products INNER JOIN testdata!orditems ;
   ON Products.product_id = Orditems.product_id;
 GROUP BY Products.prod_name;
 ORDER BY 2 DESC


Select the Ten Worst Selling Products

Select the 10 Worst-Selling Products

File: ...\Samples\Vfp98\Solution\Data\Worstten.qpr

This query displays the 10 worst-selling products based on sales recorded in the Order Items table. The query uses the TOP n feature of the SELECT statement, and, because the default order is from smallest to largest, ordering by the sum of price and quantity returns the 10 lowest values.

SELECT TOP 10 Products.prod_name,;
  SUM(Orditems.unit_price*Orditems.quantity);
 FROM testdata!products INNER JOIN testdata!orditems ;
   ON Products.product_id = Orditems.product_id;
 GROUP BY Products.prod_name;
 ORDER BY 2


Draw Lines and Shapes on a Form

File: ...\Samples\Vfp98\Solution\Forms\Graphics\Fdmain.scx

This sample illustrates how to use form graphics methods (PSet, Line, and Circle) and properties (DrawMode, DrawStyle, DrawWidth) to allow a user to draw figures and shapes on a form in different colors and different pen widths.

The sample includes a toolbar (defined in Fdproc.prg) and a form (based on frmFD in Fd.vcx). The user can select settings in the toolbar that affect the graphics properties of the form. When the form is set to accept user drawing, the MousePointer is set to 2 (cross-hairs).

The drawing functionality is coded in the methods associated with the MouseDown and MouseMove events of the form.

* MouseDown
PARAMETERS nButton, nShift, nXCoord, nYCoord
IF THIS.MousePointer = 2
   THIS.PSet(nXCoord, nYCoord)
ENDIF

* MouseMove
PARAMETERS nButton, nShift, nXCoord, nYCoord
IF THIS.MousePointer = 2
   THISFORM.LINE(nXCoord, nYCoord)
ENDIF


Graph Equations on a Form

File: ...\Samples\Vfp98\Solution\Forms\Graphics\Graph.scx

This sample shows how to graph equations with form graphics. The user can scale the equation by choosing the Zoom command buttons. The user can also move the graph's origin by clicking and dragging.

The graphing engines for this sample are in two programs: Cgraph.prg and Pgraph.prg. CGRAPH graphs equations based on Cartesian coordinates. PGRAPH graphs equations based on Polar coordinates. These programs use the PSet and Line methods of a form to draw the equation.

The following code, associated with the OneGraph method of the form set, runs the CGRAPH program when a user chooses the Graph button:

THISFORMSET.frmGraph.Draw

   DO cgraph WITH ;
      graph.equation, ;
      graph.step, ;
      graph.ecolor, ;
      graph.connect, ;
      THISFORMSET.nFormX, ;
      THISFORMSET.nFormY, ;
      .F., ;
      THISFORMSET.frmgraph, ;
      THISFORMSET.nFormScale

The following table lists the parameters for CGRAPH:

Parameter | Type | Description
equation | C | The equation in terms of X. Will plot the answer as Y.
step | N | Step increment.
ecolor | N | Equation color.
connect | L | Whether the previous point is connected to the current point with a line.
nFormX | N | Point on form where x = 0
nFormY | N | Point on form where y = 0
lAddCoords |  | Whether to draw coordinate lines.
frmgraph | C | Name of the form to write to.
nFormScale | N | Scale to graph the equation at.


Display Line Animation on a Form

File: ...\Samples\Vfp98\Solution\Graphics\Anim.scx

This sample illustrates drawing lines on a form. More specifically, it demonstrates saving coordinates of sets of lines drawn on a form and redrawing them, along with additional lines at intermediate positions, giving the illusion of motion.

Adding Lines to the Table

Each time a user draws a line on the form, its coordinates are stored in a table with the following structure:

Name | Type | Description
Frameno | I | Incremented each time the user chooses New Frame.
Objno | I | Incremented each time a line is added to a frame.
X1 | I | The starting X coordinate for a line.
X2 | I | The ending X coordinate for a line.
Y1 | I | The starting Y coordinate for a line
Y2 | I | The ending Y coordinate for a line.

Playing the Frames

The following code plays the frames, uses the table again in another work area, selects the second work area, and goes to the next frame:

USE (lcTable) AGAIN IN 0 ALIAS shadow
SELECT shadow
LOCATE FOR frameno # &lcTable..frameno

The variable nBetween determines how many intermediate lines are drawn on the form between a line in one frame and the corresponding line in the next frame.

FOR nb = 1 TO nBetween

Inside the FOR loop, the code scans for all of the lines associated with a frame and calculates coordinates for the intermediate lines, for example:

nx1 = frames.x1 + nb * (shadow.x1 - frames.x1) / nBetween
ny1 = frames.y1 + nb * (shadow.y1 - frames.y1) / nBetween

The code then prints each intermediate line, and after a WAIT of .05 seconds clears the form and continues the loop.

THISFORMSET.frmAnimation.line(nx1,ny1,nx2,ny2)


Create a Single Table Data Entry Form

File: ...\Samples\Vfp98\Solution\Forms\Single.scx

This sample illustrates the simplest scenario for a single-user, single-table data entry form.

The ControlSource property of each of the text boxes and combo boxes on the form is set to a field in the Customer table.

An APPEND BLANK command is issued in the Click event of cmdNew.

APPEND BLANK
THISFORM.Refresh

The DELETE command is issued in the Click event of cmdDelete.

* cmdDelete.Click
#DEFINE MSGBOX_YES      6
#DEFINE C_MSGBOX1      36
#DEFINE C_DELETE_LOC   "Are you sure you want to delete this record?"

IF MESSAGEBOX(C_DELETE_LOC,C_MSGBOX1) = MSGBOX_YES
   DELETE
   IF !EOF()
      SKIP 1
   ENDIF
   IF EOF() AND !BOF()
      SKIP -1
   ENDIF
   THISFORM.Refresh
ENDIF

Extending the Data Entry Form

To create a more robust data entry form, one that allows a user to cancel changes or allows multiple users to access the same data, you need to use transactions and table or row buffering. For more information on these features, see Chapter 17, "Programming for Shared Access," in the Visual FoxPro Programmer's Guide.


Create a 1-To-Many Data Entry Form

File: ...\Samples\Vfp98\Solution\Forms\Many.scx

This sample illustrates the basic tasks associated with a 1-to-many data entry form.

When you choose the New button beside the parent table text boxes, the following code is executed:

SELECT CUSTOMER
APPEND BLANK
THISFORM.Refresh

When you choose the New button beside the grid that displays the child records, more code is executed.

After selecting the orders table, the code calculates a new id value for the order, adds the blank record, then stores the parent id and order id to the appropriate fields.

CALCULATE MAX(order_id) ALL TO lMaxID
lMaxID = ALLTRIM(STR(VAL(lMaxID) + 1))

APPEND BLANK

REPLACE cust_id WITH Customer.Cust_id IN orders
REPLACE order_id with lMaxID in orders

Note This method of creating a new id value would not be reliable if multiple users were adding new orders at the same time. Instead, you can create a new id as illustrated in the Create a Default Unique ID Value for a Field sample.


Create an SDI Form

File: ...\Samples\Vfp98\Solution\Forms\Sdiform.scx

This sample illustrates Visual FoxPro support of SDI forms. In order to create an SDI form, all you have to do is set the form's ShowWindow property to 2 – s Top-Level Form. SDI forms do not require the Visual FoxPro window to be visible.

Adding Forms

There are two ways to add forms to a Top-Level (SDI) form. The first and easiest is to create a new form and set its ShowWindow property to 1 (In Top-Level form). While this may seem the most appropriate, it is not always the best solution because the ShowWindow property can only be set at design time.

Another method is to use the ACTIVATE WINDOW command. The code below from the SDIForm sample shows just this. Since this command is not object-based, you must reference a form by its window name (Name property).

ACTIVATE WINDOW (thisform.oWindows[m.nGetWin].NAME) ;
IN WINDOW (thisform.name)

Adding Menus

Menus can also be added to SDI forms. There is now a new Top-Level Form check box in the Menu Designer's View menu General Options dialog box. A Top-Level Form menu will be generated if you check this option and can be called as shown here.

DO sdiform.mpr WITH THISFORM,.T.

Note If system menu items rely on the main Visual FoxPro window being visible, they won't give the expected results when the main Visual FoxPro window is hidden.

Adding Toolbars

In addition to menus and windows, you can also add toolbars to your SDI forms. Toolbars are objects like forms, so you can take advantage of the Visual FoxPro object model and scope that toolbar to the form. The SDI form sample uses a custom property to create and keep the toolbar in scope.

SET CLASSLIB TO sditbar ADDITIVE
thisform.oToolbar=create("sditb1")
thisform.oToolbar.show


Return a Value from a Form

File: ...\Samples\Vfp98\Solution\Forms\Logform.scx

This sample illustrates returning a value from a login form. The launching form (Logform.scx) uses the DO FORM command to run the login form and store the return value to a variable (cUser).

DO FORM Login TO cUser

Note To return a value from a form, the WindowType property of the form must be set to 1 - Modal.

The login form (Login.scx) allows a user to enter a user name and a password. Code associated with the Click event of cmdOK checks to make sure that the correct password was entered.

LOCATE FOR UPPER(login.userid) = UPPER(ALLTRIM(THISFORM.txtUserName.Value))

IF FOUND() AND ALLTRIM(password) == ALLTRIM(THISFORM.txtPassword.Value)
   THISFORM.cUser = ALLTRIM(login.userid)
   THISFORM.Release
ELSE
   #DEFINE MISMATCH_LOC "The user name or password is incorrect. Please try again."
   WAIT WINDOW MISMATCH_LOC TIMEOUT 1.5
   THISFORM.txtUserName.Value = ""
   THISFORM.txtPassword.Value = ""
   THISFORM.txtUserName.SetFocus
ENDIF

Code associated with the Unload event of the login form returns the name of the user, if the user entered the correct password, or an empty string.

RETURN THIS.cUser


Provide What's This Help on a Form

File: ...\Samples\Vfp98\Solution\Forms\Whatthis\Whatthis.scx

When you provide What's This Help on a form, a button with a question mark is displayed in the upper right corner of the form.

When a user clicks this button or presses SHIFT+ F1, the form is set to WhatsThis mode. You can also programmatically enter this state by calling the WhatsThisMode method of the form. When the form is in WhatsThis mode, the mouse pointer changes. A user can click a control and get context-sensitive help for that control in a pop-up window.

Note If the WhatsThisHelpID of a control or a form is set to -1 (the default), the text in the pop-up window indicates that no help topic is available for the control.

To provide What's This Help

  1. Create a Help file with a topic for each control on the form.

  2. In the Map section of the Help project, map HelpContextID values to the topics.

  3. Set the WhatsThisHelp property of the form to true (.T.).

  4. Set the WhatsThisButton property of the form to true (.T.).

  5. Set the WhatsThisHelpID of the controls to the appropriate helpcontextID values.

  6. In the Load or Init of the form, use the SET HELP TO command to specify the help file for the form.

In addition to Whatthis.scx, this sample includes the following files:

File | Description
Whatthis.hlp | The Help file for the form
Whatthis.hpj | The Help project file
Whatthis.rtf | The source document for the Help file


Create a Query-By-Example Form

File: ...\Samples\Vfp98\Solution\Forms\Qbf.scx

This sample enables users to search and filter records in the same interface that they view the records.

When a user chooses Enter QBF, the code associated with the Click event of cmdQBFMode begins a transaction and appends a blank record to the table to store the user's query text.

* extract from cmdQBFMode.Click
BEGIN TRANSACTION
APPEND BLANK
THISFORM.Refresh

When the user chooses Query, code associated with the Click event of cmdExecuteQBF rolls back the transaction, throwing away the new record.

You can use transactions only with tables contained in a database. If you want to include QBF capabilities for a table that is not in a database, you can loop through all the controls on the form, save the old ControlSource property setting and set the ControlSource property of the controls to an empty string. After getting the user query string, you can loop back through the controls and reset the ControlSource properties.

Code associated with the Click event of cmdExecuteQBF also loops through the controls on the form, checks for user-entered values, and calls the ParseCondition method to assemble the filter string.

A user can enter a single value to match or an expression. For example, a user can enter either of the values below in the Title text box to set a filter:

Sales Manager

!= "Sales Manager"

If the user doesn't enter an expression, quotation marks aren't required.

The ParseCondition Method

LPARAMETERS cCondition, cControlSource
LOCAL lcRetCondition, lcFieldName
IF TYPE('cCondition') = 'C'
   cCondition = ALLTRIM(cCondition)
ENDIF

lcFieldName = SUBSTRC(cControlSource,(RATC(".",cControlSource)+1))

IF !EMPTY(cCondition) THEN
   IF TYPE('cCondition')$ "CM"
      IF ("<"       $ cCondition OR ;
         "=="    $ cCondition OR ;
         "LIKE"    $ cCondition OR ;
         "<>"    $ cCondition OR ;
         "!="    $ cCondition OR ;
         "#"    $ cCondition OR ;
         "="    $ cCondition OR ;
         ">"    $ cCondition)
           lcRetCondition = lcFieldName + cCondition
      ENDIF
   ENDIF

   IF EMPTY(lcRetCondition)
      DO CASE
         * put quotes around character expressions
         CASE TYPE(cControlSource) $ "CM"
            lcRetCondition = lcFieldName + " = " + CHR(34) + cCondition + CHR(34)

         * put braces around date expressions
         CASE TYPE(cControlSource) $ "DT"
            lcRetCondition = lcFieldName + " = {" + DTOC(cCondition) + "}"

         OTHERWISE
            lcRetCondition = lcFieldName + " = " + STR(cCondition)
      ENDCASE
   ENDIF
ELSE
   lcRetCondition = ""
ENDIF

RETURN lcRetCondition


Programmatically Manipulate Objects

File: ...\Samples\Vfp98\Solution\Forms\Objects.scx

This sample shows how to set properties at run time for objects in a form set. The sample form set contains two forms. Code associated with the Click event of controls on both forms change the property settings of other controls.

When setting properties of controls at run time, remember to reference the control through its container hierarchy. For example, to set the Value property of a control on one form from code in a method of another form, reference the highest-level container (the form set), and all subsequent containers.

THISFORMSET.frmLeft.chkBold.Value = .F.

For a more detailed description of this sample, see Chapter 9, "Creating Forms," in the Programmer's Guide.


Run Multiple Instances of a Form

File: ...\Samples\Vfp98\Solution\Forms\Launch.scx

This sample demonstrates running multiple instances of a form. aForms is an array property of the form that launches the multiple instances. The following code is associated with the Click event of the command button that launches multiple forms:

Get the number of the last element in the array

nInstance = ALEN(THISFORM.aForms)

Determine the Top and Left Properties to cascade the new forms. These settings are passed as parameters when the form instances are launched.

IF nInstance > 1 AND ;
   TYPE('THISFORM.aForms[nInstance -1]') = 'O'
   nFormTop = THISFORM.aForms[nInstance -1].Top + 1
   nFormLeft = THISFORM.aForms[nInstance -1].Left + 1
ELSE
   nFormTop = 1
   nFormLeft = 1
ENDIF

Set the caption to reflect the instance number

cFormCaption = "Instance" + ALLTRIM(STR(nInstance))

Run the form and assign the object variable to the array element. The Linked keyword indicates that all instances will be released when the array is released. Without LINKED, the multiple instance forms would persist after the array is released.

DO FORM Multi NAME THISFORM.aForms[nInstance] WITH ;
   nFormTop, nFormLeft, cFormCaption LINKED

Redimension the array so that more instances of the form can be launched.

DIMENSION THISFORM.aForms[nInstance + 1]


Pass Parameters Between Forms

File: ...\Samples\Vfp98\Solution\Forms\Param.scx

This solution illustrates passing parameters to a form and returning a value back.

PARAM Form

This form has the user enter a question and possible responses. Then, in the Click event of the cmdAsk button, the ParamAsk form is opened by passing the Question and Possible responses.

cParam1 = THISFORM.txtPassValue1.value
nParam2 = THISFORM.opgPassValue2.value

DO FORM LOCFILE("ParamAsk.scx") WITH cParam1, nParam2 TO nRetValue

PARAMASK Form

The PARAMETERS are passed to the Init of the form where they are processed.

PARAMETERS cQuestion, nButtons
THISFORM.txtQuestion.caption = cQuestion

In the Unload event of the form, the value stored in retvalue is returned back to the calling form:

RETURN THISFORM.retValue


Display Pictures in an Image Control

File: ...\Samples\Vfp98\Solution\Forms\Image.scx

This sample illustrates displaying bitmaps or icons in an image control.

The list box on the form displays files. In the InteractiveChange event of the list box, the Picture property of the image control is set to the selected file, if the file is a .bmp or .ico.

* lstFiles.InteractiveChange
cSelected = UPPER(THIS.List(THIS.ListIndex))
CD THIS.List(2)
IF ".BMP"$cSelected OR ".ICO"$cSelected
   THISFORM.imgDisplay.Picture = THIS.List(2) + cSelected
ENDIF


Run Word, Excel, and Graph automation

File: ...\Samples\VFP98\Solution\Ffc\Automate.scx

This sample contains the following classes.

Class | Library | Description
_xtab | _utility.vcx | Generates a cross-tab report.
_mail merge | Mailmerge.vcx | Generates a Word mail merge using the core Mail Merge Wizard engine.
_pivottable | Pivtable.vcx | Generates an Excel pivot table using the core PivotTable Wizard engine.
_autograph | _utility.vcx | Generates a graph using the core Graph Wizard engine.

This sample demonstrates adding automation routines to your application. Choose the buttons in the dialog box to generate a cross tab summary, an Excel pivot table, a Word mail merge document, and a data graph.

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Add Miscellaneous Form Buttons

File: ...\Samples\VFP98\Solution\Ffc\Buttons.scx

This sample contains the following classes.

Class | Library | Description
_shellexecute | _environ.vcx | Runs applications other than Visual FoxPro in the Windows shell.
_mailbtn | _miscbtns.vcx | Uses the MAPI ActiveX control to send an email message from a form.
_cmdlaunch | _miscbtns.vcx | Provides a button to launch an application using the Run command.
_cmdok | _miscbtns.vcx | Releases a form and updates any outstanding buffered data.
_cmdcancel | _miscbtns.vcx | Releases a form and discards any outstanding buffered data.
_cmdhelp | _miscbtns.vcx | Provides a button that displays a Help topic.
_cmdrunform | _miscbtns.vcx | Provides a button to run a form.
_cmdrunreport | _miscbtns.vcx | Provides a button to run a report.

This sample demonstrates adding command buttons to your application. The command buttons perform the following functions:

  • Launch an application

  • Open a web page in the Windows shell

  • Display a form

  • Preview a report

  • Stop a program with OK or Cancel options

  • Display a Help topic

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Handle Data Conflicts

File: ...\Samples\VFP98\Solution\Ffc\Conflicts.scx

This sample contains the following classes.

Class | Library | Description
_conflicts | _dataquery.vcx | Displays a dialog box allowing you to resolve conflicting rows encountered during editing sessions under optimistic buffering.
_nav4picbutton | _table.vcx | Displays two additional buttons that provide GO TOP and GO BOTTOM functions to the _Nav2PicButton class.
_resizable | _controls.vcx | Causes objects dropped onto a form to resize and move with the Form's resize event.
_datachecker | _datanav.vcx | Traps for data conflicts.

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Add a Data-Bound Calendar

File: ...\Samples\VFP98\Solution\Ffc\Datacal.scx

This sample contains the following classes.

Class | Library | Description
_olecalendar | _datetime.vcx | Displays a calendar that highlights a date, bound to a field in a table.
_nav2buttons | _table.vcx | Displays a pair of navigation buttons.

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Use Edit Buttons for a Complex Form

File: ...\Samples\VFP98\Solution\Ffc\\Dataedit.scx

This sample contains the following classes.

Class | Library | Description
picbtns | Wizbtns.vcx | Provides a full set of edit and navigation buttons.

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Use Edit Buttons for a Simple Form

File: ...\Samples\VFP98\Solution\Ffc\Dataedit2.scx

This sample contains the following classes.

Class | Library | Description
_picformbtns | _wizbtns.vcx | Displays buttons that provide Find, Print, Add, Delete, and Exit functions.

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Add Data Lookup Combo Boxes

File: ...\Samples\VFP98\Solution\Ffc\DataLook2.scx

This sample contains the following classes.

Class | Library | Description
_cbodistinctvalues | _dataquery.vcx | Performs a lookup of unique values in the controlsource field to populate a combo box.
_cbolookup | _dataquery.vcx | Performs a lookup of values in a field to populate a combo box.
_nav2buttons | _table.vcx | Displays a pair of buttons that provide GoNext( ) and GoPrevious( ) functions.

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Add Navigation to Forms

File: ...\Samples\VFP98\Solution\Ffc\DataNav.scx

This sample contains the following classes.

Class | Library | Description
_nav2buttons | _table2.vcx | Displays a pair of buttons that provide GoNext( ) and GoPrevious( ) functions.
_nav4buttons | _table2.vcx | Displays two additional buttons that provide GO TOP and GO BOTTOM functions to the _Nav2Button class.
_tablenav | _table.vcx | A non-visual class that provides data navigation to other controls.
_nav2picbuttons | _table2.vcx | Displays a pair of picture buttons that provide GoNext( ) and GoPrevious( ) functions.
_gotobutton | _table2.vcx | Provides a button that displays a Go To dialog box.

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Add Data Querying to Forms

File: ...\Samples\VFP98\Solution\Ffc\DataQry.scx

This sample contains the following classes.

Class | Library | Description
_findnextbuttons | _table.scx | Provides a Find/Find Next button set for navigating within a table.
_locatebutton | _table2.vcx | Provides a Locate button to display a dialog box for navigating within a table.
_findbutton | _table.vcx | Provides a generic Find button.

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Add Data Sorting and Filtering to Forms

File: ...\Samples\VFP98\Solution\Ffc\DataSort.scx

This sample contains the following classes.

Class | Library | Description
_sortbutton | _table2.vcx | Provides buttons to perform an ascending or descending order sort of data.
_navtoolbarclass | _table2.vcx | Provides data navigation controls on a toolbar.
_navmenu | _table2.vcx | Provides a shortcut menu that can include data navigation options.

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Use Common Application Dialog Boxes

File: ...\Samples\VFP98\Solution\Ffc\Dialogs.scx

This sample contains the following classes.

Class | Library | Description
_splash | _dialogs.vcx | Provides a splash screen for an application.
_login | _dialogs.vcx | Provides a Login box for an application.
_aboutbox | _dialogs.vcx | Provides an About box for an application.
_keywords | _dialogs.vcx | Provides access to the keyword table (.dbf).
_locateitem | _dialogs.vcx | Displays Locate Item dialog boxes for an application.

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Generate HTML

File: ...\Samples\VFP98\Solution\Ffc\DoHTML.scx

This sample contains the following classes.

Class | Library | Description
_webform | Webview.vcx | Provides a Visual FoxPro form containing a Web browser control to display HTML text.
_resizable | Controls.vcx | Causes objects dropped onto a form to resize and move with the Form's resize event.
_dbf2html | Internet.vcx | Converts a Visual FoxPro table (.dbf) to HTML.
_frx2html | Internet.vcx | Converts a Visual FoxPro report (.frx) to HTML.

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Handle Application Environment Tasks

File: ...\Samples\VFP98\Solution\Ffc\Environ.scx

This sample contains the following classes.

Class | Library | Description
_systoolbars | _app.vcx | Handles and tracks system toolbars.
_objectstate | _app.vcx | Determines the state of an object, allowing you to save or restore its state.
_traceawaretimer | _app.vcx | Detects if the trace window is open and handles debug timing appropriately.

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Application Error Handling

File: ...\Samples\VFP98\Solution\Ffc\Error.scx

This sample contains the following classes.

Class | Library | Description
_error | _app.vcx | Provides error handling for both object and procedural code.

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Retrieve Project Location and Name

File: ...\Samples\VFP98\Solution\Ffc\GetProject.scx

This sample contains the following classes.

Class | Library | Description
_folder | _controls | Provides a dialog box for retrieving both a file and folder name.

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Create Record Bound Graphs

File: ...\Samples\VFP98\Solution\Ffc\GraphRec.scx

This sample contains the following classes.

Class | Library | Description
_graphbyrecord | _utility.vcx | Provides navigation buttons and generates graphs on a record-by-record basis using data from fields.
_nav4buttons | _table2.vcx | Displays two additional buttons that provide GO TOP and GO BOTTOM functions to the _Nav2Button class.

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Add Web Hyperlinks to a Form

File: ...\Samples\VFP98\Solution\Ffc\HyperLnk.scx

This sample contains the following classes.

Class | Library | Description
_urlcombobox | Internet.vcx | Creates a combo box for specifying and navigating to Web sites.
_hyperlinklabel | Internet.vcx | Provides Hyperlink functionality and launches a Web browser from a label.
_hyperlinkimage | Internet.vcx | Provides Hyperlink functionality and launches a Web browser from an image.
_hyperlinkcommandbutton | Internet.vcx | Provides Hyperlink functionality and launches a Web browser from a button.

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Create Coolbar Control Effects

File: ...\Samples\VFP98\Solution\Ffc\MouseFx.scx

This sample contains the following classes.

Class | Library | Description
_mouseoverfx | _ui.vcx | Highlights a contol as the mouse is dragged over it.

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Use Mover List Boxes for Selecting Data

File: ...\Samples\VFP98\Solution\Ffc\Movers.scx

This sample contains the following classes.

Class | Library | Description
_tablemover | _movers.scx | Automatically loads tables and fields from the currently selected data source.
_fieldmover | _movers.scx | Automatically loads fields from the current data source.
_sortmover | _movers.scx | Automatically handles sorting of data.
_supermover | _movers.scx | Provides a mover list box with Move, Remove, Move All, and Remove All buttons.

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Add Shortcut Menus to Objects

File: ...\Samples\VFP98\Solution\Ffc\NewMenu.scx

This sample contains the following classes.

Class | Library | Description
_shortcutmenu | _menu.vcx | Dynamically creates shortcut menus.

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Display Data Reporting Output Options

File: ...\Samples\VFP98\Solution\Ffc\Output.scx

This sample contains the following classes.

Class | Library | Description
_showtext | _reports.vcx | Provides a simple text editor in a dialog box that also contains buttons to format or save text, and to close the editor.
_outputdialog | _reports.vcx | Displays a dialog box that prompts the user for a report output options.

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Use Progress Thermometer

File: ...\Samples\VFP98\Solution\Ffc\Therm.scx

This sample contains the following classes.

Class | Library | Description
_thermometer | _therm.vcx | Provides a standard thermometer progress display class.

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Create a Visual FoxPro Web Browser

File: ...\Samples\VFP98\Solution\Ffc\DoHTML.scx

This sample contains the following classes.

Class | Library | Description
_webbrowser4 | _webview.vcx | Provides a Web browser control in a Visual FoxPro form.

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Handle Common Windowing Tasks

File: ...\Samples\VFP98\Solution\Ffc\WHandler.scx

This sample contains the following classes.

Class | Library | Description
_windowhandler | Ui.vcx | Performs several common window operations, typical for applications.

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Use Array Handling

File: ...\Samples\VFP98\Solution\Ffc\Arrays.scx

This sample contains the following classes.

Class | Library | Description
_arraylib | _utility.vcx | Provides methods for handling certain array operations that are not provided by the Visual FoxPro array functions.

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Add Menu Items at Run Time

File: ...\Samples\Vfp98\Solution\Menus\Fillmenu.scx

This sample illustrates adding menu items to a menu at run time.

The menu definition in this sample is defined in the Menu Designer, with a single prompt and an empty submenu named empty_pop.

Code is included to be executed when a user chooses any item in the menu.

PROCEDURE takeaction(cPrompt)
#DEFINE MSG_LOC "You chose " + cPrompt + "."

IF cPrompt = "Release this menu"
   RELEASE PAD dynmenu of _MSYSMENU
ELSE
   WAIT WINDOW MSG_LOC TIMEOUT 1
ENDIF

The code associated with the Click event of cmdRefresh on the form runs the menu.

DO dynamic.mpr

Then, for each item in the list, the code defines a menu item with the prompt and message text.

FOR i = 1 TO THISFORM.lstMenu.ListCount
   DEFINE BAR i OF empty_pop PROMPT (ALLTRIM(THISFORM.lstMenu.List(i,1))) ;
      MESSAGE (THISFORM.lstMenu.List(i,2))
ENDFOR

There is also code to provide the prompt to allow a user to release the menu.

DEFINE BAR i + 1 OF empty_pop PROMPT "\-"
DEFINE BAR i + 2 OF empty_pop PROMPT "Release this menu" ;
   MESSAGE "Remove the Dynamic Items menu from the menu bar."


Disable or Display a Check Beside a Menu Item

File: ...\Samples\Vfp98\Solution\Menus\Chkmenu.scx

This sample illustrates dynamically disabling menu items and displaying check marks beside specific menu items.

The menu in this sample was created in the Menu Designer and is run when the form is initialized.

DO chkmenu.mpr

To disable a menu item, include an expression that evaluates to false (.F.) in the SET SKIP OF command. For example, the following line of code in the InteractiveChange event of a check box issues SET SKIP OF with the inverse of the value of the check box, disabling the menu item when the check box is not selected.

SET SKIP OF BAR 1 OF checkitems !THIS.Value

To display a check mark beside a menu item, include an expression that evaluates to true (.T.) after the TO keyword of the SET MARK OF command. For example, the following line of code in the InteractiveChange event of a check box issues the SET MARK OF command with the Value property setting of the check box.

SET MARK OF BAR 1 OF checkitems TO THIS.Value


Coordinate Menu Items and Toolbar Buttons

File: ...\Samples\Vfp98\Solution\Menus\Toolmenu.scx

This sample illustrates coordinating menu items and toolbar buttons that provide the same functionality.

Sometimes you'll want to make particular functionality accessible from both menu items and toolbar buttons. For example, in Visual FoxPro you can save a file by choosing the Save toolbar button or by choosing Save from the File menu.

The three components to this sample are as follows:

Component | Description
Toolmenu.scx | the form
tbrBackColor in Solution.vcx | the toolbar
Toolmenu.mnx | the menu

In the Init event of the form, a toolbar object is created whose object reference is a property on the form, oToolbar.

SET CLASSLIB TO ..\solution
This.oToolbar = CREATEOBJECT('tbrbackcolor')

* Position the toolbar and show it
THIS.oToolbar.Left = THIS.Left + 10
THIS.oToolbar.Top = THIS.Top - 50
THIS.oToolbar.Visible = .T.

* Push the current menu on the stack so it can be
* restored in the Destroy event of the form.
PUSH MENU _MSYSMENU

* Run the menu
DO toolmenu.mpr

Rather than coding duplicate functionality in the toolbar and the menu, updating it both places if changes are required, the code associated with the menu items calls the code associated with the toolbar buttons. For example, the following command is associated with the first menu item:

_VFP.ActiveForm.oToolbar.cmdRed.click

The SKIP FOR clause of the menu items causes them to be disabled when the associated toolbar button is disabled. For example, the following expression is associated with the SKIP FOR clause of the first menu item:

!_VFP.ActiveForm.oToolbar.cmdRed.Enabled


Display Shortcut Menus

File: ...\Samples\Vfp98\Solution\Menus\Shortcut.scx

This sample illustrates displaying shortcut menus when a user "right-clicks" an object. When you have created a shortcut menu in the Menu Designer, the code in the form to activate the menu is very simple. The following code is associated with the RightClick event of the form:

DO frmshort.mpr WITH THIS

The following code is associated with the RightClick event of the edit boxes on the form:

DO edtshort.mpr WITH THIS

The FRMSHORT Menu

The FRMSHORT menu was designed to take an object parameter. The following code is included in the menu's setup code:

PARAMETER oREF
#PREPOP

The #PREPOP generative directive causes the code in the menu's cleanup to be generated before the ACTIVATE POPUP command. This allows you to disable or enable menu items at run time, as well as display check marks beside menu items.

The code associated with the menu items sets properties of the object that was passed to the .mpr as a parameter. For example, the Always on top item sets the AlwaysOnTop property of the form.

The following code, included in the menu's cleanup code, displays a check mark beside the Always on top item when the form's AlwaysOnTop property is set to true (.T.).

SET MARK OF BAR 4 OF frmshort TO oRef.AlwaysOnTop

The EDTSHORT Menu

The EDTSHORT menu also accepts an object parameter in its setup code. Because there is no need to display a check mark beside the items in this menu, the #PREPOP generator directive is not used.

For an alternative way to display shortcut menus, see the Create Dynamic Shortcut Menus sample.


Create Dynamic Shortcut Menus

File: ...\Samples\Vfp98\Solution\Menus\Dynshort.scx

This sample illustrates an alternative way to create shortcut menus.

The shortcut menus in the Display Shortcut Menus sample were created in the Menu Designer. The advantages of using the Menu Designer are ease of design, the ability to create cascading menus, and simple integration on a form. With the Menu Designer, however, you need a separate .mnx, .mnt, and .mpr file for each shortcut menu. If you make a change, you need to generate and compile the menu code again.

The dynamic shortcut menu engine is a custom class that you can add to any form: menulib in ...\Samples\Vfp98\Classes\Utility.vcx. The ShowMenu method of this class defines a menu and displays it at the MousePointer location as determined by the MROW( ) and MCOL( ) functions.

In the RightClick event of the objects you want to create a shortcut menu for, do the following:

  1. Create an array with the shortcut menu items.

  2. Pass the array to the ShowMenu method of the menulib class.

  3. Process the user choice by checking the BAR( ) value.

For example, the following code is associated with the RightClick event of the form:

LOCAL laMenu[5]

laMenu=""
laMenu[1]="\<Center"
laMenu[2]="\<Font..."
laMenu[3]="\<Minimize"
laMenu[4]="\-"
laMenu[5]="E\<xit"
thisform.oMenuShortcut.ShowMenu(@laMenu)
DO CASE
   CASE BAR()=1
      thisform.AutoCenter=.T.
   CASE BAR()=2
      thisform.SetFont
   CASE BAR()=3
      thisform.WindowState=1
   CASE BAR()=5
      thisform.Release
ENDCASE


Fun with Access/Assign Methods

File: ...\Samples\VFP98\Solution\Tahoe\Aa_fun.scx

This sample demonstrates ways to use Access/Assign methods in a form.

This sample contains the following classes.

Method | Description
caption_assign | Assigns a new value to a form's Caption property.
mybuttons_access | Returns the index of the button.
oshape_access | Returns the shape of the object.
cshapecolor_access | Returns the color of the object.
this_access | Adds a new property, then returns its value.

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Use Access/Assign Methods for Polymorphism

File: ...\Samples\VFP98\Solution\Tahoe\Aa_outline.scx

This sample uses Access/Assign methods to demonstrate object polymorphism.

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Create Active Documents for the Web

File: ...\Samples\VFP98\Solution\Tahoe\Actdoc.scx

This sample contains the following classes.

Class | Library | Description
actdoc | Actdoc.vcx | Creates and displays an Active Document.
custform | Actdoc.vcx | Creates an Active Document in a project.
ordform | Actdoc.vcx | Provides an example of a Visual FoxPro form in an Active Document.

For details on classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Track Activities in a Project

File: ...\Samples\VFP98\Solution\Tahoe\Acttrack.scx

This sample contains the following classes.

Class | Library | Description
activity_tracker | project_hook.vcx | Creates a project and a log to document project activity.

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Treeview/Listbox Drag and Drop

File: ...\Samples\VFP98\Solution\Tahoe\Listdd.scx

This sample provides demonstrations of settings for OLEDragMode and OLEDropMode properties of the Treeview and Listbox controls.

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


Fun with OLE Drag and Drop

File: ...\Samples\VFP98\Solution\Tahoe\Oledd.scx

This sample demonstrates ways to use OLE drag and drop by adding code to the OLEDragDrop and OLEDragOver events.

For details on all classes available in the foundation classes, see Visual FoxPro Foundation Classes.


OLE Drag and Drop Data Formats

File: ...\Samples\VFP98\Solution\Tahoe\Querydd.scx

This sample demonstrates how to use OLE drag and drop to report data about the dragged item by adding code to the OLEDragDrop and OLEDragOver events.


Print a Percent of Total in a Report

File: ...\Samples\Vfp98\Solution\Reports\Percent.frx

The sample report, Percent.frx, shows one way to calculate and display values at the beginning report before all the records from the record source have been printed. This sample report prints a percentage based on a total that is usually calculated and printed at the end of a report.

The sample report uses the tables, EMPLOYEE and ORDERS, in its Data Environment. A public variable and expressions using the ORDER_AMT field are used to calculate the percentages.

To sort the data appropriately for the group defined in the report, the Order property on Cursor1 is set to the EMP_ID index.

The public variable, nTotalSales, defined in the Init event of Cursor2, stores the total for all orders. The variable is declared public to make it visible beyond the Cursor2 Init code.

A field control in the Group Footer band calculates and displays the percentage for each employee using the following expression:

STR(INT((emp_total / nTotalSales)*100)) + " " + "%"

A field control in the Summary band calculates and displays the total percentage for all employees using the following expression:

STR(INT((nTotalSales / nTotalSales)*100)) + " " + "%"


Use Conditional Formatting in a Report

File: ...\Samples\Vfp98\Solution\Reports\Colors.frx

This sample report demonstrates how you can use Print When conditions for controls to change field formatting based on the values in the record. The sample prints a "Product Inventory Report." If the product item is discontinued, it is printed in strikeout. If the In Stock amount is below the reorder level and the product is not discontinued, the item is printed in red. Otherwise, the product item is printed in standard black.

This report uses the table, PRODUCTS, from the database, TESTDATA, in the Data Environment. The Detail band has field controls for the product information such as ID, name, amount in stock, and amount on order. Another field control prints a reminder when the stock goes below a set reorder amount.

To handle the three cases, three sets of field controls for the product information are layered on top of each other in the Detail band. For the first set, the text color is red; for the second, the color is black; and for the third, the font effect is Strikeout.

Each control set has a different Print When expression.

  • For the plain black fields:
    (products.in_stock > products.reorder_at) and products.discontinu = .F.
  • For the strikeout fields:
    products.discontinu = .T.
  • For the red text color fields:
    products.in_stock <= products.reorder_at and products.discontinu = .F.


Print an Invoice

File: ...\Samples\Vfp98\Solution\Reports\Invoice.frx

This report shows an invoice report that uses a view to combine information from multiple tables, a function to collect data from the user, and a 1-to-many report layout. When the report is run, the view runs first and prompts the user for a date range using a function called Datepick.prg. After the user provides the dates, the view runs and selects the records to display in the report.

The Record Source The view, INVOICE, used in this report resides in the TESTDATA database provided with the Solution project. This view combines data from four tables, CUSTOMER, ORDERS, ORDITEMS, and PRODUCTS. To filter the tables for records within a date range, the view has two filters each with a parameter, dStart_Date and dEnd_Date.

The Data Environment The view is included in the data environment. To store values collected for the view and to restore the path setting, the BeforeOpenTables method of the data environment declares three public variables: dStart_date, dEnd_Date, and cOldPath. The first two match the parameters specified in the view. The third, cOldPath, saves the current path setting so the path can be restored in the Destroy method. The path is then changed so the report is able to find the function which prompts the user for a range of dates. The final command runs the function.

The Destroy method of the data environment has public variables for the start and end dates, path setting to return the default path to what it was before the report was run, and release statements for all three of the public variables.

The Datepick.prg This function defines and runs a form class called frmDATEPICK. The form class includes four combo boxes that display and collect values to use in the public variables, dStart_Date and dEnd_Date. The four variables collected are nFromMonth, nFromYear, nToMonth, and nToYear. These variables store the user input and are used to determine the value of dStart_Date and dEnd_Date. The function also checks to make sure the user entered values for each element of the date and verifies that the end date is after the start date.

The Report Layout In the report layout, a Group Header band holds the controls for the customer information, the Detail band has the controls for the order items, and the Group Footer band holds the controls that display the calculated values for the invoice.

To format the address appropriately, an expression in the control concatenates several fields with appropriate punctuation. To calculate values in the Group Footer band, two report variables, nSubtotal and nDiscount, store values for the subtotal and the percentage discount.


Print Report Details in a Ledger Style

File: ...\Samples\Vfp98\Solution\Reports\Ledger.frx

The report, Ledger.frx, prints an employee phone list that alternates printing a gray background behind records. The data environment for this report contains the EMPLOYEE table from the Testdata.dbc in the Solution project.

In the report layout, the Page Header band has label controls that print the report title, description, and column headings. The Detail band has the field and label controls that print the information for each employee.

To print with ledger style, the controls for the employee information are on top of a rectangle. The rectangle's color is gray and it's mode is opaque. The report prints the rectangle for every other record by evaluating an expression in the Print When options of the rectangle control. The expression is MOD(nCounter,2) = 1 which uses a report variable, nCounter that increments for each record printed. The report uses the value of this variable to determine when to print the rectangle.


Print in Catalog Format

File: ...\Samples\Vfp98\Solution\Reports\Wrapping.frx

The sample report, Wrapping.frx, prints an employee directory and shows how you can wrap text around graphics, alternate the print position of controls, and float controls below fields that stretch. The data environment for this report contains the EMPLOYEE table from the Testdata.dbc in the Solution project.

The Report Layout

The Title band holds the name and description of the report. The Detail band holds the field and label controls that print for each record. For each record the report displays the following four categories of information:

  • Employee name and title

  • Biography

  • Box of quick reference information such as phone and address

  • Photograph

After printing the name and title, this report wraps the text of the biography around the photograph, alternates information from left to right, and floats the box down the page relative to the biography.

Wrap Text Around Graphics

To wrap the memo field around the picture, the report uses two field controls to display the contents of the memo field. The first control is above the picture to display two lines of text. The second field is also sized to show two lines of text, but is narrower and positioned next to the picture.

The first field control prints all of the words in the memo field up to the position where a break should occur to continue the words in the second control. The expression is shown below.

LEFTC(employee.notes,nWrapCharPos)

The second field control prints the remaining words from the memo field. The expression for the second field control is shown below.

LTRIM(RIGHTC(employee.notes,(nMemoLen-(nWrapCharPos))))

The expressions for the controls use report variables to determine the words the controls display from the memo field.

  • nFirstMemoLen determines the number of characters that can be displayed in the first field without truncating. For this report, the variables value is always 185. If you use this in your own report, you will need to change this constant to match the maximum number of characters you want above the picture.

  • nMemoLen determines the length of the memo field for the current record. This variable's expression is LENC(employee.notes).

  • nSpace determines the character position of the first space after the characters displayed in the first control. This variable's expression is AT_C(CHR(32),RIGHTC(employee.notes,(nMemoLen - nFirstMemoLen))).

  • nWrapCharPos determines the character position within the memo field where the break should occur. This variable's expression is nSpace + nFirstMemoLen.

Alternate the Position of Printed Objects

In this report, the positions of the employee biography, the quick reference group, and the photograph alternate from left to right with each record. To alternate the positions, the report has two sets of controls for the parts of the report that alternate. Because two controls are used to wrap the biography text, the first control does not alternate and, therefore, does not need to be included in the two sets.

One set of controls specifies printing with the photograph on the left side. A second set specifies the printing for the photograph on the right side. The controls in both sets use a report variable, nCounter, that calculates a count which determines when the set should print. One set prints when nCounter's value is 0; the other when the value is 1. The Print When expression for the first set of controls is MOD(nCounter,2) = 0. For the second set, the expression is MOD(nCounter,2) = 1.

Float Controls Below Controls That Stretch

This report prints the box of information that prints below the biography. Since the length of the biography varies with each record, the control that displays the biography information next to the picture is set to stretch and uses only the space necessary to print the contents of the field. The box that prints below the biography floats down the page depending on the length of the biography. This box is a group of field, label, and rectangle controls. To prevent the biography from printing on top of the group, the field position for each of the controls in the group is set to float.


Print Customer Mailing Labels

File: ...\Samples\Vfp98\Solution\Reports\Cust.lbx

This sample illustrates printing mailing labels, one for each customer in the customer table.

The labels include the following four items:

  • Company

  • Contact + ", " + Title

  • Address

  • City + ", " + Region+ " " + Country

The logo is displayed on each label by using the OLE container control.


Change Font Attributes

File: ...\Samples\Vfp98\Solution\Toolbars\Format.scx

This example illustrates using a toolbar to set FontName, FontSize, FontBold, FontItalic, ForeColor, and BackColor properties of controls on a form.

The toolbar is the tbrEditing class in ...\Samples\Vfp98\Classes\Samples.vcx. The nAppliesTo property of the class specifies whether to set the properties of the currently selected control, all text boxes and edit boxes on the form, or all controls on the form. The code in the InteractiveChange or Click event of the toolbar controls sets the properties. For example, the following code is associated with the Click event of cmdBold:

IF TYPE("_SCREEN.ActiveForm") = 'O'
   oForm = _SCREEN.ActiveForm
ELSE
   RETURN
ENDIF

DO CASE
   CASE THIS.Parent.nAppliesTo = 1   && Current Control
      oForm.ActiveControl.FontBold = THIS.Value

   CASE THIS.Parent.nAppliesTo = 2   && Text and edit boxes
      oForm.SetAll('FontBold', THIS.Value, 'TEXTBOX')
      oForm.SetAll('FontBold', THIS.Value, 'EDITBOX')

   CASE THIS.Parent.nAppliesTo = 3   && All Controls
      oForm.SetAll('FontBold', THIS.Value)
ENDCASE

The only code in the form is associated with the GotFocus event of the controls. Each GotFocus event contains the following line of code:

THISFORMSET.tbrEditing.Refresh(THIS)

The Refresh method of tbrEditing sets the values of the editing controls of the toolbar to reflect the current settings of the object whose reference is passed in as a parameter.


Use API Functions that Require a STRUCT

File: ...\Samples\Vfp98\Solution\Winapi\Systime.scx

This example illustrates calling the Windows API function GetSystemTime. GetSystemTime fills in a structure of WORD (16-bit unsigned integer) values with system time information.

C Function Declaration and Struct Definition

VOID GetSystemTime(
    LPSYSTEMTIME lpSystemTime    // address of system time structure
   );

This is the struct definition:

typedef struct _SYSTEMTIME {
    WORD wYear;
    WORD wMonth;
    WORD wDayOfWeek;
    WORD wDay;
    WORD wHour;
    WORD wMinute;
    WORD wSecond;
    WORD wMilliseconds;
} SYSTEMTIME;

Calling the Function in Visual FoxPro

The Visual FoxPro code passes GetSystemTime, a reference to a character variable, which is filled in with the WORD values.

* Visual FoxPro Code: cmdSystemTime.Click
DECLARE INTEGER GetSystemTime IN win32api STRING @
cBuff=SPACE(40)

GetSystemTime(@cBuff)

To retrieve the information from the character variable, cBuff, the following code converts 8-bit ASCII characters for year and month in the variable into 16-bit equivalents.

THIS.Parent.lblYear.Caption = ALLTRIM(STR(ASC(SUBSTR(cBuff,2)) * 256 + ASC(SUBSTR(cBuff,1))))

THIS.Parent.lblMonth.Caption = MONTH_LOC + ALLTRIM(STR(ASC(SUBSTR(cBuff,4)) * 256 + ASC(SUBSTR(cBuff,3))))


Use API Functions That Require Pointers to Arrays

File: ...\Samples\Vfp98\Solution\Winapi\Syscolor.scx

This example uses two Windows API functions to first get the system color settings (GetSysColor) and then to reset the system colors to new values (SetSysColors). Two of the three arguments required by SetSysColors are pointers to native C arrays.

GetSysColor

The GetSysColor function accepts an integer parameter, a number between 0 and 18, and returns a DWORD (32-bit unsigned integer) indicating the current color setting.

DWORD GetSysColor(
    int nIndex    // display element
   );

nIndex is a value representing an area of the interface, as defined in the following list:

#define COLOR_SCROLLBAR         0
#define COLOR_BACKGROUND        1
#define COLOR_ACTIVECAPTION     2
#define COLOR_INACTIVECAPTION   3
#define COLOR_MENU              4
#define COLOR_WINDOW            5
#define COLOR_WINDOWFRAME       6
#define COLOR_MENUTEXT          7
#define COLOR_WINDOWTEXT        8
#define COLOR_CAPTIONTEXT       9
#define COLOR_ACTIVEBORDER      10
#define COLOR_INACTIVEBORDER    11
#define COLOR_APPWORKSPACE      12
#define COLOR_HIGHLIGHT         13
#define COLOR_HIGHLIGHTTEXT     14
#define COLOR_BTNFACE           15
#define COLOR_BTNSHADOW         16
#define COLOR_GRAYTEXT          17
#define COLOR_BTNTEXT           18
#define COLOR_INACTIVECAPTIONTEXT 19
#define COLOR_BTNHIGHLIGHT      20

#if(WINVER >= 0x0400) /* Windows 95 differences */
#define COLOR_3DDKSHADOW        21
#define COLOR_3DLIGHT           22
#define COLOR_INFOTEXT          23
#define COLOR_INFOBK            24

#define COLOR_DESKTOP           COLOR_BACKGROUND
#define COLOR_3DFACE            COLOR_BTNFACE
#define COLOR_3DSHADOW          COLOR_BTNSHADOW
#define COLOR_3DHIGHLIGHT       COLOR_BTNHIGHLIGHT
#define COLOR_3DHILIGHT         COLOR_BTNHIGHLIGHT
#define COLOR_BTNHILIGHT        COLOR_BTNHIGHLIGHT
#endif /* WINVER >= 0x0400 */

SetSysColors

The SetSysColors function requires three arguments: the number of elements in two arrays and the addresses of the two arrays.

BOOL WINAPI SetSysColors(
    int cElements,                  // number of elements to change
    CONST INT *lpaElements,         // address of array of elements
    CONST COLORREF *lpaRgbValues    // address of array of RGB values
   );

Calling SetSysColors in Visual FoxPro

The following code is extracted from cmdSetSysColors.Click:

DECLARE INTEGER SetSysColors IN win32api INTEGER, STRING, STRING

Construct the elements of the first array in a character variable.

cElements = ""
FOR i = 0 TO 18
   cElements = cElements + THISFORM.DecToHex(i)
ENDFOR

Construct the elements of the second array in a character variable. The cursor that is scanned was filled with GetSysColor values in the Init of the form.

cColors = ""
SCAN
   cColors = cColors + THISFORM.DecToHex(INT(color))
ENDSCAN

=SetSysColors(18,cElements,cColors)


Read and Write VFP Registry Values

Read and Write Visual FoxPro Registry Values

File: ...\Samples\Vfp98\Solution\WINAPI\Regfox.scx

This sample shows how to access the Windows Registry using the native Visual FoxPro DECLARE-DLL command. The Windows API provides a number of functions you can use to access, read and write to the registry. The Registry.prg class library in ...\Samples\Vfp98\Classes contains a class definition that exposes these functions as methods that you can call in your applications.

The contents of the Visual FoxPro Options dialog, Field Mapping settings, and Label definitions (to name a few) are stored in the Registry. Since many of these settings are not available via SET functions, you can use Registry functions to access these values. The following code populates an array of all the settings in the Options dialog:

regfile = HOME(2)+"classes\registry.prg"
SET PROCEDURE TO (m.regfile) ADDITIVE
oReg = CreateObject("FoxReg")

DIMENSION aFoxOptions[1,2]
m.nErrNum = oReg.EnumFoxOptions(@aFoxOptions)

The following code calls the SetFoxOption method of the FoxReg class (defined in Registry.prg) to set TALK OFF in the registry:

regfile = HOME(2)+"classes\registry.prg"
SET PROCEDURE TO (m.regfile) ADDITIVE
oReg = CreateObject("FoxReg")

m.nErrNum = oReg.SetFoxOption("TALK","OFF")


Get Application Information from the Windows Registry

File: ...\Samples\Vfp98\Solution\WINAPI\Regfile.scx

This sample shows how to access the Windows registry using the native Visual FoxPro DECLARE-DLL command. The Windows API provides a number of functions you can use to access, read and write to the registry. The Registry.prg class library in ...\Samples\Vfp98\Classes contains a complete set of these functions you can use in your applications.

In this specific sample, you can use registry functions to check for the existence of a particular application. For example, you might want to distribute an application which relies on using Excel to automate the creation of a Pivot Table. The registry contains the location, version, and other information about a particular application.


Read ODBC Registry Values

File: ...\Samples\Vfp98\Solution\WINAPI\Regodbc.scx

This sample shows how to access the Windows Registry using the native Visual FoxPro DECLARE-DLL command. The Windows API provides a number of functions you can use to access, read and write to the registry. The Registry.prg class library in ...\Samples\Vfp98\Classes contains a class definition that exposes these functions as methods that you can call in your applications.

The Registry contains a listing of all installed ODBC drivers and data sources. If your application relies on using ODBC, then you might want to perform a Registry check to see if a particular driver or data source is installed. This sample shows how to query for ODBC information.

LOCAL oReg,regfile,nErrNum,lDrivers
PUBLIC aODBCData

regfile = HOME(2)+"classes\registry.prg"
SET PROCEDURE TO (m.regfile) ADDITIVE

oReg = CreateObject("ODBCReg")

DIMENSION aODBCData[1]
m.nErrNum = oReg.GetODBCDrvrs(@aODBCData)


Play Multimedia Files Using MCI Commands

File: ...\Samples\Vfp98\Solution\Forms\Mci_play.scx

This sample form uses MCI (Multimedia Command Interface) to play multimedia files and can play any visual or non-visual media that is installed on your system. However, the GETFILE( ) function prompts for the most common media files of .avi, .wav, .mov, and .mid. To choose another file, select All Files and choose the desired file.

The documentation for the MCI commands is in Chapter 7 of the Windows SDK Multimedia Programmer's Reference.

The following three Windows API functions are declared in the Init of the form:

  • mciSendString

  • mciGetErrorString

  • SetWindowPos

The DoMCI method of the form executes an MCI command that is passed in as a parameter.

Classes

You can open the form to see all the code necessary to run multimedia files, but the functionality has also been extracted into classes that you can easily incorporate into your own applications.

VideoFrame Class

The VideoFrame class in the Visual FoxPro ...\Samples\Vfp98\Classes\Samples.vcx class library can be used to play a visual multimedia file, such as a Video for Windows file. The class allows you to position and size the video to be played, and then provides built-in methods to easily play the media file.

For an example of using this class, see Video.scx in the Visual FoxPro ...\Samples\Vfp98\Solution\Forms directory.

Property | Description
AutoOpen | Specifies whether the video file should automatically open and display when the object is instantiated. The default value is true (.T.).
AutoPlay | Specifies whether the video file should automatically play when it is opened. The default value is true (.T.).
AutoRepeat | Specifies whether the video file will loop the video. Setting this to .T. will cause the video to play continuously. The default value is false (.F.).
ControlSource | Specifies a Field that contains the video file reference. If empty, the class expects a static file name to be in the VideoFile property.
MCIalias | Specifies the alias to be used by MCI. If left empty, the alias defaults to the Name property of the class. Normally this can be left empty, but if the user wants to play the same video file twice at the same time, a different alias would need to be specified for each.
VideoFile | Holds the name of a video file to play, for example: "D:\...\Samples\Vfp98\Solution\FORMS\FOX.AVI"

Method | Description
CloseVideo | Closes the video file and releases all resources associated with it.
DoMCI | Called by the other methods to execute MCI commands. It can also be called by a user to execute a specific MCI command.
OpenVideo | Opens the video file and shows the first frame.
PauseVideo | Pauses a playing video. The video can be restarted by using the PlayVideo method.
PlayVideo | Plays the video file. The video file must be opened in the OpenVideo method before it can be played.
SetPosition | Allows the user to specify the position of the media file. It can be executed at any time after the video file has been opened. Valid values are "Start", "End", or a specific millisecond into the video.

Sound Player Class

This class is also contained in the ...\Samples\Vfp98\Classes\Samples.vcx class library. It can be used to play a non-visual multimedia file, such as a waveaudio file. The class allows you to specify the file to be played, and then provides built-in methods to easily play the media file.

Property | Description
AutoOpen | Specifies whether the sound file should be automatically opened and displayed when the object is instantiated. The default value is true (.T.).
AutoPlay | Specifies whether the sound file should be automatically played when it is opened. The default value is true (.T.).
AutoRepeat | Specifies whether the sound file plays continuously. The default value is false (.F.).
ControlSource | Specifies the column that contains the sound file reference. If empty, the class expects a static file name to be in the SoundFile property.
MCIAlias | Specifies the alias to be used by MCI. If left empty, the alias defaults to the Name property of the class. Normally this can be left empty, but if the user wants to play the same sound file twice at the same time, a different alias would need to be specified for each.
SoundFile | Holds the name of a sound file to play, for example: "C:\WINDOWS\CHIMES.WAV"

Method | Description
OpenSound | Opens the sound file.
PlaySound | Plays the sound file. The file must be opened with the OpenSound method before it can be played.
PauseSound | Pauses the playing of a sound file. Play can be contiued by calling the PlaySound method.
SetPosition | Allows the user to specify the position of the media file. It can be executed at any time after the file has been opened. Valid values are "Start", "End", or a specific millisecond into the sound.
CloseSound | Closes the sound file and releases all resources associated with it.


Get Version Information

File: ...\Samples\Vfp98\Solution\WINAPI\Getver.scx

This sample allows you to display version information from a .dll or .exe.

A new function called GetFileVersion( ) has been added to Foxtool.fll which allows you to obtain version information on a file. The following code illustrates how you can call the function. See Tools\Foxtools.hlp for details on the specific array elements.

SET LIBRARY TO FoxTools ADDITIVE
DIMENSION aFileVer[12]
nRetVal = GetFileVersion(GetFile("EXE"),@aFileVer)
IF nRetVal = 0
   DISPLAY MEMO LIKE aFileVer
ENDIF
SET LIBRARY TO

Note Visual FoxPro now allows you to add File Version information to EXE and DLL files at build time. This version information is stored in a file resource and can be accessed via the Windows Explorer. EXE files created in Visual FoxPro 3.0 will not have a file version resource.


View Type Library Information

File: ...\Samples\Vfp98\Solution\Winapi\Typelib.scx

The TYPELIB sample uses a Visual FoxPro class named Typelib which is stored in ...\Samples\Vfp98\Classes\Typelib.vcx. This container class has an ActiveX control called FoxTlib that contains a number of methods to read Type Library information from any .dll, .exe, or .tlb file.

The Typelib wrapper class saves you time by handling much of the dirty work for you. There is a method called ExportTypeLib in this class which exports the contents of a specified Type Library to a text File.

THISFORM.typelib1.TypeLibName = THISFORM.txtFileName.Value
THISFORM.typelib1.ExportTypeLib( )

If you take a look at the generated text file, you will notice that a Type Library can consist of multiple Type Infos. Each Type Info represents a specific class. When you generate a new EXE or DLL from a project using Visual FoxPro, each class in the project which is marked as OLEPUBLIC will generate a separate Custom OLE Server.

Note You only have a single .exe/.dll file, however, this file can contain multiple servers (one for each OLEPUBLIC class). And Visual FoxPro generates a single TLB file for the project. This Type Library file contains a separate Type Info for each OLEPUBLIC class.

Within each Type Info (OLEPUBLIC class), there are also Function descriptions. These represent all of the properties and methods of a class. For methods, the Type Library contains both parameter and return types. Some of the possible types are boolean, string, and variant. Because Visual FoxPro does not strong type memory variables, many of the types used in your custom methods will be variant.

If you take a close look at the functions exported, you will notice double entries for many of the properties. This is because users can set or get the value of this property. And some languages such as Visual Basic allow you to have code executed when one of these properties is accessed or assigned. Hence, the Type Library will represent a single property with 2 entries. If only a single entry exists, then that property is read-only. Properties and methods which are marked as Hidden or Protected will not appear in the Type Library.


Topic Not Found

No matching topic was found. Some possible reasons and remedies are as follows:

  • The file (.chm) that contains the destination topic is not in the expected location.

    Remedy: Rerun the MSDN Library Setup.

  • The file (.chm) that contains the current topic or destination topic is out-of-date and the link is no longer valid.

    Remedy: Install the latest version of the MSDN Library.

  • The MSDN Library CD is not in the CD-ROM drive.

    Remedy: Insert the MSDN Library CD into the CD-ROM drive.


About Dialog Box

See Also

Category | Misc Forms
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Dialogs
Class | _aboutbox
Base Class | Form
Class Library | _dialogs.vcx
Parent Class | _form
Sample | ...\Samples\Vfp98\Solution\Ffc\dialogs.scx

Remarks

This class is a simple About dialog box template for custom applications. The dialog box includes a button that accesses system information using the Registry class.

To use, drop the class on a project or, from the Component Gallery Item Shortcut menu, select Add to Project. When you drop the class on a project, you can choose between adding the class, creating a subclass, or creating a form. If you choose Create a new form, Visual FoxPro displays the Open dialog so you can specify the name of the form, then creates and opens the form in the Form Designer. Specify values for the labels, then save and call the form from your application.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cMSINFODir property | Specifies the path of Msinfo.exe. Default: ""
GetRegisteredCompany method | A stub routine to return the registered company. To use, replace the lblUserCorp.Caption value.
GetRegisteredOwner method | A stub routine to return registered owner. To use, replace the lblUserName.Caption value.


(Untitled)

See Also


Array Handler (VFP Foundation Class)

Array Handler

See Also

Category | Data Utilities
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Utilities
Class | _arraylib
Base Class | Custom
Class Library | _utility.vcx
Parent Class | _custom
Sample | ...\Samples\Vfp98\Solution\Ffc\arrays.scx

Remarks

This class provides methods for handling certain array operations that are not performed by Visual FoxPro array functions, including inserting and deleting specific array elements, and scanning an array by column.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro places the class icon on the form. You can specify the appropriate property values and provide any necessary input and output objects. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
AColScan method | Scans the column nColumn, of array aSearch for the value specified in sExpr. Syntax: AcolScan(@aSearch, sExpr, nColumn, lRetRow) Return: none Arguments: aSearch specifies the array to analyze. sExpr specifies the expression to seek. nColumn specifies the column of the array in which to seek sExpr. lRetRow specifies whether the method returns the row number in which sExpr was found.
DelAitem method | Deletes an array element. Syntax: DelAitem(@aArray, wziRow) Return: none Arguments: aArray specifies the name of the array being processed. wziRow specifies the item to be deleted.
InsAitem method | Inserts an array element. Syntax: InsAitem(@aArray, sContents, iRow) Return: none Arguments: aArray specifies the name of the array being processed. sContents specifies a string value to be added to aArray. iRow specifies the row in which to insert the value in sContents.


Cancel Button (VFP Foundation Class)

Cancel Button

See Also

Category | Misc Buttons
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Buttons
Class | _cmdCancel
Base Class | CommandButton
Class Library | _miscbtns.vcx
Parent Class | _cmdOK
Sample | ...\Samples\Vfp98\Solution\Ffc\buttons.scx

Remarks

This class releases a form and discards any outstanding buffered data.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro places a button on your form. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.


Clock (VFP Foundation Class)

Clock

See Also

Category | Date/Time
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Date/Time
Class | _clock
Base Class | Container
Class Library | _datetime.vcx
Parent Class | _container
Sample | ...\Samples\Vfp98\Solution\Controls\Timer\clock.scx

Remarks

This class is a simple clock control for a form or container.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro places the object in your form where you can specify the appropriate nTimeFormat value. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
nTimeFormat property | Toggles between short (for 0) and long (for non-zero values) formats as specified in the Control Panel. Default: 0


Font combobox (VFP Foundation Class)

Font Combobox

See Also

Category | Text Formatting
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Text Formatting
Class | _cbofontname
Base Class | ComboBox
Class Library | _format.vcx
Parent Class | _combobox
Sample | ...\Samples\Vfp98\Solution\Toolbars\format.scx

Remarks

This class is a combobox that lists available fonts when placed on a form. It is also used by the tbrEditing and rtfControls classes of _format.scx.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro places a combobox on the form so you can specify appropriate font values for objects in the active form. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.


Fontsize combobox (VFP Foundation Class)

Fontsize Combobox

See Also

Category | Text Formatting
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Text Formatting
Class | _cbofontsize
Base Class | ComboBox
Class Library | _format.vcx
Parent Class | _combobox
Sample | ...\Samples\Vfp98\Solution\Toolbars\format.scx

Remarks

This class is a combobox that lists available font sizes. It is also used by the tbrEditing and RTFControls classes of _format.scx.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro places a combobox on the form so you can specify appropriate font size values for objects in the active form. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
nSmallestFont property | For scalable fonts, specifies the smallest allowable fontsize. Default: 8
nLargestFont property | For scalable fonts, specifies the largest allowable fontsize. Default: 48


Data Edit Buttons (VFP Foundation Class)

Data Edit Buttons

See Also

Category | Data Editing
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Buttons
Class | picbtns
Base Class | CommandGroup
Class Library | wizbtns.vcx
Parent Class | txtbtns
Sample | ...\Samples\Vfp98\Solution\Ffc\dataedit.scx

Remarks

This is a complete set of edit buttons that includes Top, Previous, Next, Bottom, Find, Print, Add Delete, Edit, and Save buttons. The Form Wizard uses this class.

You can use this class on simple forms with a single table or for 1-to-Many relationship forms using fields for a parent table and a grid for the child table.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Form. When you add the class to a form, Visual FoxPro places the buttons on the form. You can specify a data source and provide input and output objects. When you drop the class on a project, you can choose between adding the class or creating a subclass. The txtbtns parent class contains additional properties you can set.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
WizBMPpath property | Internal to the class.


Conflict Catcher (VFP Foundation Class)

Conflict Catcher

See Also

Category | Data Query
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Data Query
Class | _conflicts
Base Class | Form
Class Library | _dataquery.vcx
Parent Class | _form
Sample | ...\Samples\Vfp98\Solution\Ffc\Conflicts.scx

Remarks

This class provides a dialog box that displays, conflicting rows encountered during editing sessions under optimistic buffering. The original, current, and new values are presented for resolution. You can use this class with either row or table buffering.

To use, drop the class on a project or, from the Component Gallery Item Shortcut menu, select Add to Project. When you drop the class on a project, you can choose between adding the class, creating a subclass, or creating a form. If you choose Create a new form from the selected class, Visual FoxPro displays the Open dialog box so you can specify the name of the form, then creates and opens the form in the Form Designer. You need to SET MULTILOCKS ON and enable buffering.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
CursorAlias property | Specifies the alias to check for conflicts. Default: ""
lAutoCheck property | Specifies whether checking begins on startup. Default: .T.
StartCheck method | Checks for conflicts in the buffered data of the alias. Syntax: StartCheck( ) Return: none Arguments: none
ConflictAlias property | Internal to the class.
lRowConflict property | Internal to the class.
aConflicts[1,0] property | Internal to the class.
NextConflict method | Internal to the class.
CheckSource method | Internal to the class.
Alert method | Internal to the class.


Cookies Class (VFP Foundation Class)

Cookies Class

See Also

Category | Internet
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Internet
Class | _cookie
Base Class | Custom
Class Library | _internet.vcx
Parent Class | _custom

Remarks

This is a simple web class for handling cookies between web pages. This class is designed primarily for use with Microsoft Internet Information Servers like FoxISAPI.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro places the class icon on the form where you can specify the appropriate property values and provide any necessary input and output objects. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cCookie property | Name of the current cookie. Default: ""
CookieTable property | Name of the cookies table. Default: Cookies.dbf
DBFAlias property | Alias of the cookies table. Default: ""
MakeCookie method | Generates a unique cookie based on the system datetime. Syntax: MakeCookie( ) Return: none Arguments: none
GetCookie method | Gets a cookie from HTML server. Syntax: GetCookie(cStr) Return: none Arguments: cStr specifies the name of the cookie to be retrieved.
WriteCookieInfo method | Writes the cookie's information to the cookies table. Syntax: WriteCookieInfo( ) Return: none Arguments: none
FixURL method | Reads the URL and evaluates %-markers for reading the cookie. Syntax: FixURL(m.cStr) Return: Arguments: m.cStr specifies the name of the cookie to be retrieved.
GetVal method | Retrieves a value from the target string, cStr. Syntax: GetVal(cStr, cVal) Return: cVal Arguments: cStr specifies the name of the string to be searched for the value, cVal cVal specifies the value to be sought in the string, cStr.


ActiveX Calendar (VFP Foundation Class)

ActiveX Calendar

See Also

Category | Date/Time
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Data/Time
Class | _olecalendar
Base Class | OLEcontrol
Class Library | _datetime.vcx
Parent Class | _olecontrol
Sample | ...\Samples\Vfp98\Solution\Ffc\datacal.scx

Remarks

This class uses the ActiveX calendar control that can be bound to a date field for a form or other container.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Form. When you add the class to a form, Visual FoxPro opens a builder so you can specify the appropriate Date_column value. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
Date_column property | Specifies a date type field to which to link the calendar. Default: ""
RefreshDisplay method | Updates the calendar display with the value in the column specified in the Date_column property. Syntax: RefreshDisplay( ) Return: none Arguments: none


Lookup combobox (VFP Foundation Class)

Lookup Combobox

See Also

Category | Data Query
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Data Query
Class | _cbolookup
Base Class | ComboBox
Class Library | _dataquery.vcx
Parent Class | _combobox
Sample | ...\Samples\Vfp98\Solution\Ffc\datalook2.scx

Remarks

This class performs a lookup of values in a field to populate a combobox.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Form. When you add the class to a form, Visual FoxPro opens a builder so you can specify the appropriate Lookup_table, Order_column, Display_column, and Return_column values. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
Display_column property | Specifies the column value from the Lookup_table to display in the drop-down list. Default: ""
Lookup_table property | Specifies the table in which to find the column containing the values to display in the drop down list. Default: ""
Return_column property | Specifies the column value (0, 1 or 2) to return to the Value property of the combo box. Default: ""
Order_column property | Specifies the column to order the records displayed in the drop down list (optional). Default: ""


Data Navigation Buttons (VFP Foundation Class)

Data Navigation Buttons

See Also

Category | Data Navigation
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Data Navigation
Class | _datanavbtns
Base Class | Container
Class Library | _datanav.vcx
Parent Class | _container
Sample | ...\Samples\Vfp98\Solution\Ffc\Forms\single.scx

Remarks

This class is a set of navigation buttons that includes Top, Next, Prev, and Bottom buttons. It also contains the DataChecker class to check for conflicts during navigation betweeen records.

To use, drop the class on a project or form in a data environment or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, you should provide input and output objects. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cSkipTable property | The table within which to move the pointer. Default: ""
lEnableDisableOnInit property | Specifies whether the navigation buttons are enabled when they are first loaded. Default: .T.
RecordPointerMoved method | Called each time the record pointer is moved, providing a new event for the class. Syntax: RecordPointerMoved( ) Return: none Arguments: none
EnableDisableButtons method | Enables or disables buttons based on the record pointer location. Syntax: EnableDisableButtons( ) Return: none Arguments: none
BeforeRecordPointerMoved method | Called before the record pointer is moved to determine if the table contains records. Syntax: BeforeRecordPointerMoved( ) Return: none Arguments: none


Data Session Manager (VFP Foundation Class)

Data Session Manager

See Also

Category | Application
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Application
Class | _datassession
Base Class | Custom
Class Library | _app.vcx
Parent Class | _custom
Sample | ...\Samples\Vfp98\Solution\Ffc\environ.scx

Remarks

This class is used to manage data sessions and handle data updates in all forms or formsets in the current data session. It enables an Application object to easily iterate through sessions to provide Windows-closing behavior during Exit or Shutdown. It also provides generic QueryUnload behavior for forms and formsets, and generic session-wide Update and Revert code. You can use it to evaluate whether any data has been changed in a session before you use your own conflict handling procedure.

This class works with free tables as well as tables in databases. Observe the transactions limit (5).

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro places the class on the form. You can then specify the appropriate property values and provide any necessary input and output objects. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
iDataChangedMode property | Specifies the type of data change performed. 0 - Everything changed. 1 - Ignore view fields not in Updatefields list. 2- Ignore views not set to send updates. Default: 0
iSavedSessionID property | Specifies integer value representing the ID of the saved session. Default: 1
lSuccess property | Specifies whether the data operation (update) was successful. Default: .T.
lUseTransactions property | Specifies whether to wrap the updating routine in a transaction. Note Only tables in a database container (.dbc) are affected in transactions. Default: .T.
DataChanged method | Checks if data has changed. Syntax: DataChanged( ) Return: none Arguments: none
DataFlush method | Ensures that the active control will have its current contents "recognized" even if you choose to update from a toolbar button while a grid has the focus. Syntax: DataFlush( ) Return: none Arguments: none
GetActiveControlRef method | Returns the truly active control, loRealActiveControl, in cases where the current active control is a Grid. Syntax: GetActiveControlRef(toActiveControl) Return: loRealActiveControl Arguments: toActiveControl specifies the current control.
GetMessageBoxTitle method | Returns a portion of the titlebar text specifying the name of the message. Syntax: GetMessageBoxTitle( ) Return: cTitlebarText Arguments: none
QueryUnload method | Provides dialog boxes to manage data change decisions. Syntax: QueryUnload(tlDataChangeAlreadyConfirmed, toForm, tlNoShow) Return: liResult Arguments: tlDataChangeAlreadyConfirmed specifies whether data has been changed toForm specifies the form. tlNoShow specifies whether to display the form. liResult specifies the MESSAGEBOX or value.
RestoreSessionID method | Restores the data session. Syntax: RestoreSessionID Return: none Arguments: none
Revert method | Reverts the session to original data. Syntax: Revert(tlUserChoiceAlreadyConfirmed, tlDataChangeAlreadyConfirmed, toForm, tlNoShow) Return: none Arguments: tlUserChoiceAlreadyConfirmed specifies whether to display a confirmation dialog. tlDataChangeAlreadyConfirmed specifies whether to display a confirmation dialog. toForm specifies the form. tlNoShow specifies whether to display the form.
SetSessionID method | Sets the data session. Syntax: SetSessionID( ) Return: none Arguments: none
Update method | Updates data. Syntax: Update(tlUserChoiceAlreadyConfirmed, tlDataChangeAlreadyConfirmed, toForm, tlNoShow) Return: none Arguments: tlUserChoiceAlreadyConfirmed specifies whether to display a confirmation dialog. tlDataChangeAlreadyConfirmed specifies whether to display a confirmation dialog. toForm specifies the form. tlNoShow specifies whether to display the form.


Data Validation (VFP Foundation Class)

Data Validation

See Also

Category | Data Editing
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Data Query
Class | _datachecker
Base Class | Custom
Class Library | _datanav.vcx
Parent Class | _custom
Sample | ...\Samples\Vfp98\Solution\Ffc\conflicts.scx

Remarks

This class traps for data conflicts on buffered data.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, you need to specify the appropriate property values. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
HandleRecord method | Compares the current value, old value, and original value on disk of each field, displaying a message box if a change or conflict is detected. Syntax: HandleRecord(lnScope) Return: nReturn Arguments: lnScope specifies the degree of validation: 0 = check for conflicts 1 = check for conflicts and verify changes nReturn specifies the action taken: 0 = No Change 1 = Successful Change 2 = Unable to make change
String method | Called by the HandleRecord method, returns a character equivalent of the passed value. Returns only a notification for memo fields. Syntax: String(luValue) Return: none Arguments: luValue specifies the value to be checked.
VerifyChanges method | Prompts a user to save all changes made to a table or record. Syntax: VerifyChanges( ) Return: none Arguments: none
VerifyEachChange method | Prompts a user to confirm each change made. Syntax: VerifyEachChange( ) Return: none Arguments: none
CheckcConflicts method | Notifies a user when data has changed after record editing started. Syntax: CheckcConflicts( ) Return: none Arguments: none


Data Navigation Object (VFP Foundation Class)

Data Navigation Object

See Also

Category | Data Navigation
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Data Navigation
Class | _tablenav
Base Class | Custom
Class Library | _table.vcx
Parent Class | _table
Sample | ...\Samples\Vfp98\Solution\Ffc\datanav.scx

Remarks

This is non-visual navigation object that can be used by other controls to navigate records in a datasource such as a table or view.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a project, you can choose between adding the class or creating a subclass. When you add the class to a form, Visual FoxPro displays the class icon on the form so you can add data navigation objects then reference appropriate class methods on the form in the Form Designer.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
lCycle property | Controls movement when the record pointer reaches the end or beginning of the file. Default: .F.
GoBottom method | Moves record pointer to last record. Syntax: GoBottom( ) Return: none Arguments: none
GoRecord method | Moves record pointer to a specified record number. Syntax: GoRecord( ) Return: none Arguments: tiRecord
GoNext method | Moves the record pointer to the next record using SKIP 1. If this movement positions the pointer at EOF( ), behavior is determined by the lCycle property. Syntax: GoNext( ) Return: none Arguments: none
GoPrevious method | Moves record pointer to the previous record using SKIP –1 if the pointer is not already at BOF( ). If this movement positions the pointer at BOF( ), behavior is determined by the lCycle property. Syntax: GoNext( ) Return: none Arguments: none
GoTop method | Moves record pointer to first record. Syntax: GoTop( ) Return: none Arguments: none


DBF->HTML (VFP Foundation Class)

DBF->HTML

See Also

Category | Internet
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Internet
Class | _dbf2html
Base Class | Custom
Class Library | _internet.vcx
Parent Class | _custom
Sample | ...\Samples\Vfp98\Solution\Ffc\dohtml.scx

Remarks

This class converts a Visual FoxPro cursor (.DBF) to HTML. Hooks control the scope, visual layout and HTML generation. For more information on creating web pages from Visual FoxPro tables, see Genhtml.prg.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro opens a builder so you can accept the current values or specify the appropriate cSource, cOutFile, and nGenOutput values. When you drop the class on a project, you can choose between adding the class or creating a subclass.

Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cSource property | Specifies the source file from which to generate HTML. Default: ""
nGenOutput property | _GENHTML output options. 0 = Generate output file. 1 = Generate and display the output file in the Visual FoxPro editor. 2 = Generate and display the output file in Internet Explorer. 3 = Generate and display the output file after displaying a Save As dialog box 4 = Create PUBLIC _oHTML object and generate a file. 5 = Create a PUBLIC _oHTML object without generating a file. Default: 2
cOutFile property | Specifies the name of the HTML file to output. Default: ""
lAutoNameOutput property | Specifies whether _GENHTML should automatically name the output file based on the source. Default: .T.
lUseCurrentAlias property | Specifies whether to use the current alias as the source. Default: .T.
cScope property | Specifies the scope (for example, NEXT or ALL) for the output. Default: ""
cStyle property | Specifies the visual style as listed in the ID field of Genhtml.dbf. Default: ""
GenHTML method | Generates HTML code by calling the Genhtml.prg program using properties specified in cSource, cOutput, and nGenOutput. Syntax: GenHTML( ) Return: none Arguments: none


Run Form Button (VFP Foundation Class)

Run Form Button

See Also

Category | Misc Buttons
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Buttons
Class | _cmdRunForm
Base Class | CommandButton
Class Library | _miscbtns.vcx
Parent Class | _commandbutton
Sample | ...\Samples\Vfp98\Solution\Ffc\buttons.scx

Remarks

This class provides a generic button to run a form.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Form. When you add the class to a form, Visual FoxPro opens a builder so you can specify cFileName, the name of the form you want to run. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cFilename property | Specifies the name of the form to run. Default: ""
lSetCaption property | Specifies whether the caption is automatically based on the value of cFilename. Default: .T.


Distinct Values combo (VFP Foundation Class)

Distinct Values Combo

See Also

Category | Data Query
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Data Query
Class | _cbodistinctvalues
Base Class | ComboBox
Class Library | _dataquery.vcx
Parent Class | _combobox
Sample | ...\Samples\Vfp98\Solution\Ffc\datalook2.scx

Remarks

This class performs a lookup of unique values in the ControlSource field to populate a combobox.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Form. When you drop the class on a form, Visual FoxPro places a combobox on the form. You need to specify an appropriate value for the ControlSource property. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.


Resize object (VFP Foundation Class)

Resize Object

See Also

Category | User Interface
Default Catalog | Visual FoxPro Catalog\Foundation Classes\User Controls
Class | _resizable
Base Class | Custom
Class Library | _controls.vcx
Parent Class | _custom
Sample | ...\Samples\Vfp98\Solution\Forms\cresize.scx

Remarks

This class causes objects dropped onto a form to resize and move with the Form's Resize event.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, specify the AdjustControls method in the Resize event of the controls on the form. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
InitialResize property | Specifies whether controls have been adjusted before. Default: .T.
AdjustControls method | Adjusts the placement and size of contained objects after a Resize event. Syntax: AdjustControls( ) Return: none Arguments: none
Reset method | Resets the Timer control so that it starts counting from 0. Syntax: Reset( ) Return: none Arguments: none
InitialFormHeight property | Internal to the class.
InitialFormWidth property | Internal to the class.
aControlStats[1,5] property | Internal to the class.
AddToArray method | Internal to the class.
SetSize method | Internal to the class.
LoopThroughControls method | Internal to the class.


Error Object (VFP Foundation Class)

Error Object

See Also

Category | Application
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Application
Class | _error
Base Class | Custom
Class Library | _app.vcx
Parent Class | _custom
Sample | ...\Samples\Vfp98\Solution\Ffc\error.scx

Remarks

This class is a generic error handler that works for both object and procedural code. This class is used with an application framework generated by the Application Wizard.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro places the class icon on the form. You can then specify the appropriate property values and access its functionality from input and output objects. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
GetMessageBoxTitle method | Returns the truly active control, loRealActiveControl, in cases where the current active control is a Grid. Syntax: GetActiveControlRef(toActiveControl) Return: ERROR_MESSAGEBOX_TITLE_LOC Arguments: none
cCurrentMessage property. | Specifies the error message. Default: ""
cCurrentMethod property | Specifies the method in which the error occurred. Default: ""
iCurrentError property | Specifies the error number. Default: 0
iCurrentLine property | Specifies the line in which the error occurred. Default: 0
cCurrentClassproperty | Specifies the error classification that the error object specifies for this particular error number. Default: ""
lServer property | Checks _VFP.StartMode to determine whether any sort of modal feedback should be avoided because of the way Visual FoxPro was started. Default: (BETWEEN(_VFP.StartMode,1,3)))
cLogAlias property | Specifies the name of the log alias. Default: ""
cLogDBF property | Specifies the name of log file (DBF) that is built by the _error object. Default: ""
lUserCancelled property | Allows the outside program to perform any necessary cleanup operations before release. Default: .F.
HandleMain method | The routine that handles the error. Syntax: HandleMain(tiError, tcMethod, tiLine) Return: none Arguments: tiError specifies the error number. tcMethod specifies the name of the current method. tiLine specifies the number of the current line.
OKToReport method | Abstract class to evaluate whether to report error. Syntax: OKToReport( ) Return: none Arguments: none
isTrivial method | Specifies whether an error is a trivial error. Syntax:IsTrivial(tlWantDialog) Return: none Arguments: tlWantDialog specifies an optional dialog to display.
isFatal method | Specifies whether an error is a fatal error. Syntax:( ) Return: Arguments: tlWantDialog specifies an optional dialog to display.
GetMessageBoxTitle method | This is meant for your subclass or instance to fill out with application-specific information. Syntax: GetMessageBoxTitle( ) Return: none Arguments: none
DisplayErrorLog method | Displays the error log. Syntax: DisplayErrorLog( ) Return: none Arguments: none
OKToContinue method | Evaluates an error to determine whether to continue program execution. Syntax: OKToContinue( ) Return: none Arguments: none
SetLog method | Determines the name of or creates the error log table and alias. Syntax: SetLog( ) Return: cLogAlias The error log table has the following format: CREATE TABLE (THIS.cLogDBF) ; (errstamp t, ; listingm,; usernotesm) Arguments: none
cCurrentErrorParam property | Internal to the class.
aErrorClass[1,3] property | Internal to the class.
aErrors[1,6] property | Internal to the class.
*FillArrays. | Internal to the class.
LogErrorReport method | Internal to the class.
GetErrorAttribute method | Internal to the class
isGoodErrorLog method | Internal to the class.
UserHandlesError method | Internal to the class.
UserCancelled method | Internal to the class.
FillLogRecord method | Internal to the class.
DoErrorLogUI method | Internal to the class.


Field Mover (VFP Foundation Class)

Field Mover

See Also

Category | Movers
Default Catalog | Visual FoxPro Catalog\Foundation Classes\User Controls
Class | _fieldmover
Base Class | Container
Class Library | _mover.vcx
Parent Class | _supermover
Sample | ...\Samples\Vfp98\Solution\Ffc\movers.scx

Remarks

This is a super mover list box class that automatically loads fields from the current data source when you drop it on a form.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro opens a builder so you can accept or specify the appropriate SkipGeneral, SkipMemo, and AllowReadOnly values. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
AllowReadOnly property | Allows for a read-only datasource. Default: .F.
AutoInit property | Automatically run when loaded. Default: .T.
CurrentAlias property | The current alias determined by ALIAS( ). Default: ""
CurrentDBC property | The current database file. Default: ""
CursorType property | Specifies the type of cursor. 1 = local view 2 = remote view 3 = table Default: 3
DBCTable property | Name of the table in the database. Default: ""
MultiTable property | Specifies whether to support multiple tables. Default: .F.
SkipGeneral property | Specifies whether General fields are included in the list. Default: .F.
SkipMemo property | Specifies whether Memo fields are included in the list. Default: .F.
TableType property | Returns the table type - SYS(2029). Default: 0
AcolScan method | Scans a specific column in the array. Syntax: AcolScan(@wztarr, wztexpr, wztcol) Return: none Arguments: wztarr specifies the array to scan. wztexpr specifies the target expression for which to scan. wztcol specifies the column to scan.
AddToArray method | Adds sContents to the array, aAddToArray, at iRow. Syntax: AddToArray(@aAddToArray, sContents, iRow) Return: none Arguments: aAddToArray specifies the array to which to add an item. sContents specifies the addition to the array. iRow specifies in which array row to insert sContents.
Alert method | Displays a messagebox. Syntax: Alert(pMessage) Return: none Arguments: pMessage specifies the message to be displayed by MESSAGEBOX( ).
FieldChange method | Triggered when fields selected changes. Syntax: FieldChange(nButton) Return: none Arguments: nButton specifies the button pressed.
GetTableData method | Retrieves fields from a table. aWizFlist contains the list of fields, aCalcFields contains the list of calculated fields, aPickFields contains the list of selected fields. Syntax: GetTableData( ) Return: aWizFList, aCalcFields, aPickFields Arguments: none
InitData method | Initializes data. Syntax: InitData( ) Return: none Arguments: none
InitVars method | Initializes variables used by movers. Syntax: InitVars( ) Return: none Arguments: none
JustStem method | Retrieves the filename stem. Syntax: JustStem(m.filename) Return: m.filename Arguments: m.filename specifies the filename from which the stem is extracted.
SetDataProps method | Sets data properties of the data source. Syntax: SetDataProps( ) Return: none Arguments: none
UpdateStatusbar method | Internal to the class.


Application Registry (VFP Foundation Class)

Application Registry

See Also

Category | System Utilities
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Utilities
Class | _filereg
Base Class | Custom
Class Library | _registry.vcx
Parent Class | registry
Sample | ...\Samples\Vfp98\Solution\WinAPI\regfile.scx

Remarks

This class provides a set of registry functions that return application-specific information such as version and location.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro places the class on the form. You can then specify the appropriate values and provide any necessary input and output objects. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
GetAppPath method | Checks and returns path of the application associated with a particular extension. Syntax: GetAppPath(cExtension, cExtnKey, cAppKey, lServer) Return: GetApplication(cExtnKey, @cAppKey, lServer) Arguments: cExtension Specifies the extension of the application. cExtnKey Specifies the registry key of the application. cAppKey Specifies the application path. lServer Specifies whether the extension is a server application.
GetLatestVersion method | Returns latest version for a specified application. Syntax: Getlatestversion(cClass, cExtnKey, cAppKey, lServer) Return: cExtnKey, @cAppKey, lServer Arguments: cClass Specifies the class key of the application. cExtension Specifies the extension of the application. cExtnKey Specifies the registry key of the application. cAppKey Specifies the application path. lServer Specifies whether the this is a server application.
GetApplication method | Retrieves the application key. Syntax: Getapplication(cExtnKey, cAppKey, lServer) Return: @cAppKey Arguments: cExtension Specifies the extension of the application. cExtnKey Specifies the registry key of the application. cAppKey Specifies the application path. lServer Specifies whether the extension is not a full application.


File Version (VFP Foundation Class)

File Version

See Also

Category | File Utilities
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Utilities
Class | _fileversion
Base Class | Custom
Class Library | _utility.vcx
Parent Class | _custom
Sample | ...\Samples\Vfp98\Solution\WinAPI\getver.scx

Remarks

Retrieves information from the version resource of a file and stores it in an array.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro places the class on the form. You can then specify the appropriate values and provide any necessary input and output objects. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cFileName property | The name of the target file. Default: ""
aVersion[12,0] property | Array containing the file version information. Default: .F.
GetVersion method | Retrieves version information for cFileName. Syntax: GetVersion( ) Return: none Arguments: none
DisplayVersion method | Displays the version information for cFileName. Syntax: DisplayVersion( ) Return: none Arguments: none


Filter Dialog Box Button (VFP Foundation Class)

Filter Dialog Box Button

See Also

Category | Data Query
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Buttons
Class | _filterbutton
Base Class | CommandButton
Class Library | _table2.vcx
Parent Class | _dialogbutton
Sample | ...\Samples\Vfp98\Solution\Ffc\datasort.scx

Remarks

This class is a button that, when clicked, displays a dialog that enables you to filter data in a particular field.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro places a button on the form. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
lExprDialog property | Internal to the class.
cExprClass property | Internal to the class.
cFilterClass property | Internal to the class.


Filter Dialog Box (VFP Foundation Class)

Filter Dialog Box

See Also

Category | Data Query
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Data Query
Class | _filterdialog
Base Class | Form
Class Library | _table.vcx
Parent Class | _form
Sample | ...\Samples\Vfp98\Solution\Ffc\datasort.scx

Remarks

This class is a dialog box that uses an existing filter object to allow you to filter data in a particular field.

To use, drop the class on a project or, from the Component Gallery Item Shortcut menu, select Create Form or Add to Project. When you drop the class on a project, you can choose between adding the class, creating a subclass, or creating a form. When you drop the class on a project or choose Create a new form from the selected class in the shortcut menu, Visual FoxPro displays an Open dialog box so you can specify the name of the form. Then Visual FoxPro creates and opens the form in the Form Designer.

_FilterDialog enables you to use Visual FoxPro expressions to build a complex filter using booleans, nested conditions, and so on, limited to the fields available in currently-open tables. It automatically provides delimiters for various field types. It suggests which expressions might be optimizable by checking available tags on the current table. The field list places "*" in front of field names that have usable index tags.

Like _FilterExpr, _FilterDialog needs at least one open table on which it can set a filter. Unlike _FilterExpr, _FilterDialog is not necessarily modal, however it is modal when _FilterExpr calls it. FilterDialog determines the current table in the Init event. FilterDialog never changes data sessions.

When called by _FilterExpr, _FilterDialog determines what filter the user has already specified in the _FilterExpr edit box and displays that expression as its initial set of conditions. When _FilterDialog is called directly, it checks the current alias for a filter, using SET("FILTER"), and shows any current filter as its initial conditions.

The _FilterDialog SetUpFilter( ) method uses the conditions listed in the dialog and creates a filter expression, then applies the NORMALIZE( ) function to the expression. The result is stored in the cFilter property. When you click OK, SetupFilter( ) runs. _FilterDialog calls the _FilterExpr.SetFilter method if it is called by an instance of _FilterExpr; otherwise it uses _table to determine if navigation is allowed, sets the filter directly, and refreshes the display if the filter is set.

_FilterDialog is a standalone object and does not require the existence of _FilterExpr to build a filter. However, when called by _FilterExpr, the two dialogs work together to build a filter, by specifying an expression in _FilterExpr and by making choices in _FilterDialog. For more information on the Filter Expression class, see _Filter Expression.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cFilter property | Contains the filter expression processed in the SetupFilter method. Default: ""
SetupFilter method | This method takes the conditions listed in the dialog and creates them into a filter expression, then applies the NORMALIZE( ) function to the expression. Syntax: SetupFilter(tcValue) Return: cFilter Arguments: tcValue specifies an expression to use as the filter. cFilter is the value contained in the cFilter property.
cOldexact property | Internal to the class.
iBact property | Internal to the class.
iQptr property | Internal to the class.
iQuerymax property | Internal to the class.
iSelect property | Internal to the class.
oCaller property | Internal to the class.
aDBFs[1,0] property | Internal to the class.
aTags[1,0] property | Internal to the class.
aQuery[1,0] property | Internal to the class.
aFLDs[1,0] property | Internal to the class.
SetAction method | Internal to the class.
QReset method | Internal to the class.
QSet method | Internal to the class.
FSet method | Internal to the class.
NoBrack method | Internal to the class.
Brackets method | Internal to the class.
SetTags method | Internal to the class.
OnTag method | Internal to the class.
NoTag method | Internal to the class.
EditQuery method | Internal to the class.
SetRowsources method | Internal to the class.
SetInitialQueryParts method | Internal to the class.


Filter Expression Dialog Box (VFP Foundation Class)

Filter Expression Dialog Box

See Also

Category | Data Query
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Data Query
Class | _filterexpr
Base Class | Form
Class Library | _table.vcx
Parent Class | _form
Sample | ...\Samples\Vfp98\Solution\Ffc\datasort.scx

Remarks

This class creates an advanced filter expression dialog.

To use, drop the class on a project or, from the Component Gallery Item Shortcut menu, select Create Form or Add to Project. When you drop the class on a project, you can choose between adding the class, creating a subclass, or creating a form. When you drop the class on a project or choose Create a new form from the selected class in the shortcut menu, Visual FoxPro displays an Open dialog box so you can specify the name of the form. Visual FoxPro then creates and opens the form in the Form Designer.

_FilterExpr is a modal dialog that enables you to specify a filter expression, or to construct a filter expression using one of two subsidiary dialogs.

The lAdvanced property toggles _FilterExpr between two modes, standard and advanced. In standard mode, the Build expression button uses an instance of the _FilterDialog class to build a simple expression. In advanced mode, the button uses the value in the _GETEXPR system variable.

The cFilter property contains the current contents of the filter expression the user builds. The edit box bound to the cFilter property can contain up to 254 characters.

If _FilterExpr doesn’t find a table on which to act, it returns false (.F.) before leaving the Init event; otherwise it restores these settings in its Unload method. When _FilterExpr instantiates, if ALIAS( ) is empty, it looks for an open table in the current data session of the currently selected form or formset.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cFilter property | Contains the filter expression processed in the SetupFilter method. Default: (SPACE(254))
lAdvanced property | This is used to toggle _FilterExpr between two modes, _FilterDialog false (.F) and GETEXPR true (.T.). Default: .F.
iOldSession property | The old data session. Default: 0
iOldSelect property | The old work area. Default: 0
SetFilter method | Sets the value of cFilter. This method is primarily useful when _FilterDialog is called modally to do further work on the expression to be built. Syntax: SetFilter(tcValue) Return: cFilter Arguments: tcValue specifies an expression to use as the filter. cFilter is the filter expression.
SetFilterOnTable method | If the current table allows navigation, this method applies the current filter to the current alias, issues a LOCATE, and then invokes the RefreshLastWindowAfterChange( ) method to get the filter for the next available window in your application. Syntax: SetFilterOnTable( ) Return: none Arguments: none
cFilter_Access method | Internal to the class. Removes carriage returns, line feeds, and tabs from the filter expression and replaces these characters with spaces.


Find Button (VFP Foundation Class)

Find Button

See Also

Category | Data Query
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Data Query
Class | _findbutton
Base Class | Container
Class Library | _table.vcx
Parent Class | _container
Sample | ...\Samples\Vfp98\Solution\Ffc\dataqry.scx

Remarks

This class provides a generic Find button, uses the Find object, and locates a record based on specific criteria.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro opens a builder so you can specify the appropriate cFindString, lMatchCase, lSkipMemo, and lWraparound values. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cAlias property | Specifies the data source in which to search. Default: ""
cFindString property | Specifies the string for which to search. Default: ""
lFindAgain | Specifies whether the file is traversed to find successive instances of cFindString. Default: .F.
lMatchCase property | Specifies the case-sensitivity of the search. Default: .F.
lSkipMemos property | Specifies whether to ignore Memo fields in the search. Default: .F.
lWrapAround property | Specifies whether to continue searching from the beginning if the end of file (EOF) is reached. Default: .F.
DoFind method | Performs a search. Syntax: DoFind( ) Return: none Arguments: none
SkipField method | Removes the field, tcSkipField from the search. Syntax: SkipField( ) Return: none Arguments: none tcSkipField specifies the field to ignore during the search.


Find Dialog Box (VFP Foundation Class)

Find Dialog Box

See Also

Category | Data Query
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Data Query
Class | _finddialog
Base Class | Form
Class Library | _table.vcx
Parent Class | _form
Sample | ...\Samples\Vfp98\Solution\Ffc\dataqry.scx

Remarks

This class provides a generic Find dialog with simple options such as field choice. This class uses the Find object.

To use, drop the class on a project or, from the Component Gallery Item Shortcut menu, select Create Form or Add to Project. When you drop the class on a project, you can choose between adding the class, creating a subclass, or creating a form. When you drop the class on a project or choose Create a new form from the selected class in the shortcut menu, Visual FoxPro displays an Open dialog box so you can specify the name of the form, then creates and opens the form in the Form Designer.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cAlias property | Specifies the data source in which to search. Default: ""
cFindString property | Specifies the string for which to search. Default: ""
lAdvanced property | Specifies whether to display the advanced options in the dialog box. Default: .F.
lFindAgain | Specifies whether the file is traversed to find successive instances of cFindString. Default: .F.
lMatchCase property | Specifies the case-sensitivity of the search. Default: .F.
lSkipMemos property | Specifies whether to eliminate Memo fields from the search. Default: .F.
lWrapAround property | Specifies whether to continue searching from the beginning if end of file reached. Default: .F.
DOFind method | Performs a search. Syntax: DoFind( ) Return: none Arguments: none
SkipField method | Removes the field, tcSkipField, from the search. Syntax: SkipField( ) Return: none Arguments: none tcSkipField specifies the field to ignore during the search.


Find Files_Text (VFP Foundation Class)

Find Files/Text

See Also

Category | File Utilities
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Utilities
Class | _filer
Base Class | Custom
Class Library | _utility.vcx
Parent Class | _custom
Sample | ...\Samples\Vfp98\Tools\Filer\filer.scx

Remarks

This wrapper class uses the FILER.DLL COM object to search for files. It is a simplified version of the filer form.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro opens a builder so you can specify the appropriate cFileExpression, cSearchPath, cSearchText, lIgnoreCase, lSubFolder, and lWholeWords values. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cFileExpression property | Specifies a file skeleton for the search. This expression can include wildcards such as ? and *. Default: ""
cSearchPath property | Specifies the directory in which to begin searching for files. Default: ""
cSearchText property | Specifies the text string to search for within files. Default: ""
lIgnoreCase property | Specifies whether to ignore case during the search. Default: .T.
lPromptDir property | Specifies whether to prompt the user for a search path if none is entered. Default: .T.
lSubFolder property | Specifies whether to search in subfolders for files. Default: .T.
lWholeWords property | Specifies whether to search for whole word matches. Default: .F.
oFiles property | Specifies a collection of files returned by the Find search. Default: .F.
Find method | Searches for files that meet the criteria specified by the properties. Syntax: Find( ) Return: none Arguments: none


Find (Findnext) Buttons (VFP Foundation Class)

Find (Findnext) Buttons

See Also

Category | Data Query
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Data Query
Class | _findnextbuttons
Base Class | Container
Class Library | _table.vcx
Parent Class | _findbutton
Sample | ...\Samples\Vfp98\Solution\Ffc\dataqry.scx

Remarks

This class provides a generic find/findnext buttonset.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro opens a builder so you can specify the appropriate values. When you drop the class on a project, you can choose between adding the class or creating a subclass.

When placed on a form or other container, this class locates a record using a Find object based on specified criteria. For details, see Find Button or _findbutton in the _table.vcx class library in the Class Browser.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.


Find Object (VFP Foundation Class)

Find Object

See Also

Category | Data Query
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Data Query
Class | _tablefind
Base Class | Custom
Class Library | _table.vcx
Parent Class | _table
Sample | ...\Samples\Vfp98\Solution\Ffc\dataqry.scx

Remarks

This class creates a generic object that locates a record based on specified critereria. The class also provides an optional Find Next method.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro opens a builder so you can specify appropriate cFindString, lMatchCase, lSkipMemo, lWrapAround values. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cFields property | Specifies the list of fields to search. Default: ""
cFindString property | Specifies the string for which to search. Default: ""
lFindAgain | Specifies whether the file is traversed to find succesive instances of cFindString. Default: .F.
lMatchCase property | Specifies whether to use case-sensitivity in the search. Default: .F.
lSkipMemos property | Specifies whether to ignore Memo fields in the search. Default: .F.
lWrapAround property | Specifies whether to continue searching from the beginning if end of file (EOF) is reached. Default: .F.
SkipField method | Removes tcSkipField from the search. Syntax: SkipField( ) Return: none Arguments: none tcSkipField specifies the field to ignore during the search.
aMemos [1] property | Internal to the class. Default: .F.
iMemos property | Internal to the class. Default: 0
cControlCharacter property | Internal to the class. Default: ~


FRX->HTML (VFP Foundation Class)

FRX->HTML

See Also

Category | Internet
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Internet
Class | _frx2html
Base Class | Custom
Class Library | _internet.vcx
Parent Class | _custom
Sample | ...\Samples\Vfp98\Solution\Ffc\dohtml.scx

Remarks

This class converts a Visual FoxPro report (.FRX) to HTML. The class includes properties to control the scope, visual layout and HTML generation. For more information, see Genhtml.prg.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro opens a builder so you can specify the cSource, cOutFile, nGenOutput, and lAutonameOutput values. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cOutFile property | Specifies the name of the HTML file to create. Default: ""
cSource property | Specifies the source file from which to generate HTML. Default: ""
nGenOutput property | _GENHTML output options. 0 = Generate output file. 1 = Generate and display the output file in the Visual FoxPro editor. 2 = Generate and display the output file in Internet Explorer. 3 = Generate and display the output file after displaying a Save As dialog box 4 = Create a PUBLIC _oHTML object and generate a file. 5 = Create a PUBLIC _oHTML object without generating a file. Default: 2
lAutoNameOutput property | Specifies whether _GENHTML should automatically name the output file based on the source. Default: .T.
cScope property | Specifies the scope (for example, NEXT or ALL) for the output. Default: ""
cStyle property | Specifies the visual style as listed in the ID field of Genhtml.dbf. Default: ""
GenHTML method | Generates HTML code by calling the Genhtml.prg program using properties specified in cSource, cOutput, and nGenOutFile. Syntax: GenHTML( ) Return: none Arguments: none


Get file and directory (VFP Foundation Class)

Get File and Directory

See Also

Category | User Interface
Default Catalog | Visual FoxPro Catalog\Foundation Classes\User Controls
Class | _folder
Base Class | Container
Class Library | _controls.vcx
Parent Class | _container
Sample | ...\Samples\Vfp98\Solution\Ffc\getproject.scx

Remarks

This dialog retrieves both a file and folder name. It is used to create new projects in directories of the same name.

To use, drop the class on a project or form. When you drop the class on a project, you can choose between adding the class or creating a subclass. When you drop the class to a form, Visual FoxPro places the class controls including a Browse button on your form.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cLastProjectFile property | Internal to the class.
cExt property | Internal to the class.
TrimFile property | Internal to the class.


GoTo Dialog Box Button (VFP Foundation Class)

GoTo Dialog Box Button

See Also

Category | Data Navigation
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Buttons
Class | _gotobutton
Base Class | CommandButton
Class Library | _table2.vcx
Parent Class | _dialogbutton
Sample | ...\Samples\Vfp98\Solution\Ffc\Buttons.scx

Remarks

This class creates a button that displays the GoTo dialog box so you can navigate to a specific record.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you drop the class on a form, Visual FoxPro places a button on your form. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.


GoTo Dialog Box (VFP Foundation Class)

GoTo Dialog Box

See Also

Category | Data Navigation
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Data Navigation
Class | _gotodialog
Class Library | _table.vcx
Parent Class | _form
Sample | ...\Samples\Vfp98\Solution\Ffc\datanav.scx

Remarks

This class creates a GoTo Record dialog box.

To use, drop the class on a project or, from the Component Gallery Item Shortcut menu, select Create Form. When you drop the class on a project, you can choose between adding the class, creating a subclass, or creating a form. When you drop the class on a project or choose Create a new form from the selected class in the shortcut menu, Visual FoxPro opens a builder so you can specify the name of the form, then creates and opens the form in the Form Designer.

_GoToDialog is a modal dialog with a _TableNav member and a spinner to allow the user to specify a record number. When you click OK, the GoToRecord method navigates to the specified record, then runs the RefreshLastWindowAfterChange method to update the display. Note that GoToRecord( ) updates the display even if the table does not permit navigation, in case you revert a change.

_GoToDialog uses _TableNav to determine the current alias at startup. It then sets the spinner SpinnerLowValue and KeyboardLowValue to 1 and SpinnerHighValue and KeyboardHighValue to RECCOUNT( ). It also sets the spinner Value property appropriately.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
RefreshUIAfterChange method | Internal to the class.


Graph Object (VFP Foundation Class)

Graph Object

See Also

Category | Automation
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Automation
Class | autograph
Base Class | Custom
Class Library | autograph.vcx
Parent Class | automation
Sample | ...\Samples\Vfp98\Solution\Ffc\Automate.scx

Remarks

This custom class generates a chart by automating MS Graph using the core Graph Wizard engine.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro opens a builder so you can specify the cOutputfile, nChartType, lAddLegend, and lSeriesByRow values. You can also use the autograph class and supply values for fields, chart type, the preview form, and default name in program code. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
aDataFields[1,1] property | Specifies the name of a numeric field in the target table (the "Y" axis value). Default: .F.
cCategoryField property | Specifies a field in the target table (the "X" axis). Default: .F.
cOutFile property | Name of the output file if any. Default: ""
cTitle property | Title caption of the chart. Default: ""
lCurrRec property | Specifies whether to retain the current record number, if only graphing one record. Default:.F.
lAddedData property | Flags if data is already added for performance. Default: .F.
lAddLegend property | Adds a legend to the chart. Default: .T.
lAddTitle property | Adds a title to the chart. Default:.T.
lGraphRecord property | Specifies whether to graph the current record. The default graphs the entire cursor. Default: .F.
lKeepForm property | Specifies whether to use the user-supplied form and OLE control. Default: .F
lSeriesByRow property | Plots a series by row or column. Default: .T.
lShowNulls property | Displays null values in the chart. Default: .T.
lShowWhenDone property | Specifies whether to display a preview of the form. Default: .T.
lUse8Type property | Specifies whether to use the nChartType property. Default: .F.
lUseAutoformat property | Use the MS Graph autocharting gallery. Default:.F.
nAction property | Specifies the type of output action: 0 = preview 1 = save to form 2 = save to table 3 = save to query Default: 1
nChartAutoformat property | Chart format for autoformat. Default: 2
nChartAutoGallery property | Gallery chart format for autoformat. Default: 1
nChartSubType property | Sub type of chart. Default: 1
nChartType property | Specifies the chart type. The valid values are: 1 = Area 2 = Bar 3 = Column 4 = Line 5 = Pie 6 = Doughnut 7 = Radar 8 = Scatter 9 = Area 3D 10 = Bar 3D 11 = Column 3D 12 = Line 3D 13 = Pie 3D -4102 = Pie 3D Default: 1
nGraphVersion property | Version of Graph being used. Default: 5
cDefNewField property | Internal to the class.
cGraphDBF property | Internal to the class.
cGraphField property | Internal to the class.
cGraphFldCol property | Internal to the class.
cGraphFldRow property | Internal to the class.
cGraphPrevClass property | Internal to the class.
cLastDataCol property | Internal to the class.
cLastDataRow property | Internal to the class.
cOLEServer property | Internal to the class.
cOpenAlias property | Internal to the class.
cOutGenField property | Internal to the class.
GraphPreview property | Internal to the class.
lAutograph property | Internal to the class.
lDontStripLegend property | Internal to the class.
lHadPreview property | Internal to the class.
lReplaceDBF property | Internal to the class.
lStripExcessLegend property | Internal to the class.
nDataCount property | Internal to the class.
nDataSeries property | Internal to the class.
nLastAction property | Internal to the class.
nTotalDataFlds property | Internal to the class.
oGraphRef property | Internal to the class.


Graph by Record (VFP Foundation Class)

Graph By Record

See Also

Category | Automation
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Automation
Class | _graphbyrec
Base Class | Container
Class Library | _utility.vcx
Parent Class | _container
Sample | ...\Samples\Vfp98\Solution\OLE\automate.scx

Remarks

This container class creates graphs at the record level, unlike the AutoGraph class which creates graphs from an entire Visual FoxPro cursor. The class also includes a set of buttons to navigate between records and dynamically refresh the chart.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form in a data environment, Visual FoxPro opens a builder so you can specify the nChartType and cLblField values for the graph data points and axis labels. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cLblField property | Specifies the caption for the record label. Default: ""
nChartType property | Specifies the chart type. The valid values are: 1 = Area 2 = Area 3D 3 = Bar 4 = Bar 3D 5 = Column 6 = Column 3D 7 = Pie 8 = Pie 3D 9 = Line 10 = Line 3D Default: 4
lSeriesByRow property | Specifies whether to plot a series by row. Default: .T.
aDataFields[1] property | Specifies the array of data fields to graph. Default: .F.
SetupGraph method | Initializes graph controls. Syntax: SetupGraph( ) Return: none Arguments: none
RefreshGraph method | Refreshes the graph when the record pointer is moved. Syntax: RefreshGraph( ) Return: none Arguments: none


Help Button (VFP Foundation Class)

Help Button

See Also

Category | Misc Buttons
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Buttons
Class | _cmdHelp
Base Class | CommandButton
Class Library | _miscbtns.vcx
Parent Class | _commandbutton
Sample | ...\Samples\Vfp98\Solution\Ffc\buttons.scx

Remarks

This class provides a button that, when clicked, displays a Help topic by searching for the HelpContextID specified in the control.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Form. When you add the class to a form, Visual FoxPro places a button on your form. You need to provide the appropriate value to replace the default value of HelpContextID. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.


Hyperlink Button (VFP Foundation Class)

Hyperlink Button

See Also

Category | Internet
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Internet
Class | _hyperlinkcommandbutton
Base Class | CommandButton
Class Library | _hyperlink.vcx
Parent Class | _commandbutton
Sample | ...\Samples\Vfp98\Solution\Ffc\buttons.scx

Remarks

This class provides the functionality of the Hyperlink object and launches a Web Browser when you click a button.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro opens a builder so you can specify the button name and the URL to use. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cTarget property | Specifies the URL to use. Default: ""
GoBack method | Executes a hyperlink jump backward within the history list. Syntax: GoBack( ) Return: none Arguments: none
GoForward method | Executes a hyperlink jump forward within the history list. Syntax: GoForward( ) Return: none Arguments: none
cFrame property | Internal to the class.
cHyperlinkclass property | Internal to the class.
cHyperlinkClassLibrary property | Internal to the class.
cLocation property | Internal to the class.
lFormSynch property | Internal to the class.
lHyperlinkCreated property | Internal to the class.
lNewWindow property | Internal to the class.
lVisited property | Internal to the class.
nVisitedForecolor property | Internal to the class.
oHyperlink property | Internal to the class.
cTarget_assign method | Internal to the class.
Follow method | Internal to the class.
lVisited_assign( ) method | Internal to the class.
nVisitedForecolor_assign( ) method | Internal to the class.
oHyperlink_access( ) method | Internal to the class.
ShowVisitedForecolor( ) method | Internal to the class.


Hyperlink image (VFP Foundation Class)

Hyperlink Image

See Also

Category | Internet
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Internet
Class | _hyperlinkimage
Base Class | Image
Class Library | _hyperlink.vcx
Parent Class | _image
Sample | ...\Samples\Vfp98\Solution\Ffc\hyperlnk.scx

Remarks

This class provides the functionality of the Hyperlink object and launches a Web Browser when you click an image.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro opens a builder so you can specify the image name and the URL to use. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cTarget property | Specifies the URL to use. Default: ""
GoBack method | Executes a hyperlink jump backward within the history list. Syntax: GoBack( ) Return: none Arguments: none
GoForward method | Executes a hyperlink jump forward within the history list. Syntax: GoForward( ) Return: none Arguments: none
cFrame property | Internal to the class.
cHyperlinkClass property | Internal to the class.
cHyperlinkClassLibrary property | Internal to the class.
cLocation property | Internal to the class.
cTarget_assign method | Internal to the class.
Follow method | Internal to the class.
lFormsSynch property | Internal to the class.
lHyperlinkcreated property | Internal to the class.
lNewWindow property | Internal to the class.
lVisited property | Internal to the class.
oHyperlink property | Internal to the class.
oHyperlink_access method | Internal to the class.


Hyperlink label (VFP Foundation Class)

Hyperlink Label

See Also

Category | Internet
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Internet
Class | _hyperlinklabel
Base Class | Label
Class Library | _hyperlink.vcx
Parent Class | _label
Sample | ...\Samples\Vfp98\Solution\Ffc\hyperlnk.scx

Remarks

This class provides the functionality of the Hyperlink object and launches a Web Browser when you click a label.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro opens a builder so you can specify the label and the URL (in cTarget) to use. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cTarget property | Specifies the URL to use Default: ""
GoBack method | Executes a hyperlink jump backward within the history list. Syntax: GoBack( ) Return: none Arguments: none
GoForward method | Executes a hyperlink jump forward within the history list. Syntax: GoForward( ) Return: none Arguments: none
cFrame property | Internal to the class.
cHyperlinkClass property | Internal to the class.
cHyperlinkClassLibrary property | Internal to the class.
cLocation property | Internal to the class.
cTarget_assign method | Internal to the class.
Follow method | Internal to the class.
lFormsSynch property | Internal to the class.
lHyperlinkcreated property | Internal to the class.
lNewWindow property | Internal to the class.
lVisited property | Internal to the class.
oHyperlink property | Internal to the class.
oHyperlink_access method | Internal to the class.


Web Browser control (VFP Foundation Class)

Web Browser Control

See Also

Category | Internet
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Internet
Class | _webbrowser4
Class Library | _webview.vcx
Parent Class | olecontrol
Sample | ...\Samples\Vfp98\Solution\Ffcwebvwr.scx

Remarks

This subclass of the Internet Explorer 4 Browser control provides hooks for Visual FoxPro code and can be added to a Visual FoxPro form.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro places an Internet Explorer logo on your form. You need to specify an appropriate URL in the Navigate method. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
aHistory[1,2] property | URL address history array. Default: .F.
aParam[1,0] property | URL parameters array. Default: .F.
aScripts[1,0] property | Visual FoxPro scripts array. Default: .F.
cAlias property | Returns the table alias of the currently selected. Set automatically when using the OpenTable method. Default: ""
cBeforeURL property | Specifies the current URL before a document is fully retrieved. Default: ""
cBlankHTMLFile property | Specifies a blank .htm file. Default: Blank.htm
cDBF property | Returns the file name of currently selected table. Set automatically when using the OpenTable method. Default: ""
cDBFPath property | Returns the path of the currently selected table. Set automatically when using the OpenTable method. Default: ""
cFilename property | Returns the file name of the current document. Default: ""
cFilepath property | Returns the path of the current document. Default: ""
cLasturl property | Specifies the last URL. Default: ""
cNewURL property | Specifies the URL before the document is fully retrieved. Default: ""
cParam property | Specifies the URL parameter string. Default: ""
cParamdelimiter property | Specifies the URL parameter delimiter character. Default: &
cParseFileExt property | File extension list of the file to parse in pre-processing mode. Default: htm;html;asp
cProgramPath property | Specifies the web browser control class path. Default: ""
cSourceFile property | Specifies the file name of current document. Default: ""
cSourceFilename property | Specifies the file name of current source document. Default: ""
cSourceFilepath property | Specifies the path of current source document. Default: ""
cSourceHTML property | Specifies the HTML text of the current source document. Default: ""
cSourceURL property | Specifies the URL of the current source document. Default: ""
cTempFilename property | Specifies the file name of the temporary file document. Default: ""
cTempFilePrefix property | Prefix used for the file name of the temporary file document. Default: _temp
cURL property | Current URL. Default: ""
cUserID property | User ID, user defined, not used internally. Default: ""
cUserName property | User name, user defined, not used internally. Default: ""
cVersion property | Specifies the version of the web browser control subclass. Default: "Web Browser 04.01.0006"
cVFPScript property | Specifies the Visual FoxPro script program file name. Default: ""
cVFPScriptTable property | Specifies the Visual FoxPro script table file name. Default: ""
cVFPSprotocol property | Specifies the default Visual FoxPro script protocol string. Default: vps:
lBlankHTMLStartup property | Specifies whether the browser starts with a blank startup web page. Default: .F.
lBusy property | Web browser busy mode. Default: .F.
lDebug property | Specifies whether the web browser runs in Debug mode. Default: .F.
lDesign property | Specifies whether the web browser runs in design mode. Default: .F.
lDHTML property | Specifies whether the web browser supports dynamic HTML. Default: .T.
lHistoryEnabled property | Specifies whether URL history tracking is enabled. Default: .F.
lParseSource property | Specifies whether Parse document source mode is enabled. Default: .F.
lRefresh property | Specifies whether the control is refreshed when the Refresh method runs. Default: .F.
lRefreshDeactivate property | Specifies whether auto-execution of the RefreshDeactivate method for the LostFocus event is enabled. Default: .F.
lRefreshMode property | Specifies whether Refresh document mode is enabled. Default: .F.
lRelease property | Specifies whether the object's Release method has been executed and the object is in the process of being released from memory. Default: .F.
lRunCodeMode property | Specifies whether Run code mode is enabled. Default: .F.
lVFPsScript property | Specifies whether Visual FoxPro script mode is enabled. Default: .F.
lViewSourceMode property | Specifies whether View source mode is enabled. Default: .F.
nDataSessionID property | Specifies the data session number of the table alias of the currently selected table that was set automatically when using the OpenTable method. Default: 0
nHistoryCount property | Specifies the length of the URL history array. Default: 0
nParamCount property | Specifies the length of the URL parameter array. Default: .F.
nRecno property | Specifies the current record number of the currently selected table that was set automatically when using the OpenTable method. Default: 0
nScriptCount property | Specifies the length of the Visual FoxPro script array. Default: 0
nUserLevel property | Specifies the user level, user defined, not used internally. Default: 0
oAction property | Specifies the user action object, user defined, not used internally. Default: .NULL.
oHost property | Specifies the host form – equivalent to THISFORM. Default: .NULL.
oSource property | Specifies the source object, user defined, not used internally. Default: .NULL.
oUser property | Specifies the user object, user defined, not used internally. Default: .NULL.
uResult property | Specifies the variant result value. Default: .T.
uReturn property | Specifies the variant return value. Default: .T.
uValue property | Specifies the variant value, user defined, not used internally. Default: .T.
AddProp method | Adds a new property. Syntax: AddProp(tcName, tcProperty, tuValue) Arguments: tcName specifies tcProperty specifies the name of the property. tuValue specifies the value to assign to the property.
BeforeNavigate method | Provides a BeforeNavigate event. Syntax: BeforeNavigate(URL, flags, targetframename, postdata, headers, cancel) Arguments: URL specifies the web page to use. flags specifies whether to addthe resource to the history list, to read or write from the cache, display the resource in a new window or a combination of these. targetframename specifies the name of the target frame. postdata specifies data to send to the HTTP Post transaction. headers specifies the HTTP headers to send. cancel specifies whether navigation was cancelled.
BeforeRetrieval method | Identifies the event to run before retrieval. Syntax: BeforeRetrieval(URL, flags, targetframename, postdata, headers, cancel) Arguments: URL specifies the web page to use. flags specifies whether to addthe resource to the history list, to read or write from the cache, display the resource in a new window or a combination of these. targetframename specifies the name of the target frame. postdata specifies data to send to the HTTP Post transaction. headers specifies the HTTP headers to send. cancel specifies whether navigation was cancelled.
BrowseTable method | Browse the currently selected based on cAlias. Syntax: BrowseTable(tcAlias, tcClauses)
CloseTable method | Close the currently selected based on cAlias. Syntax: CloseTable(tcAlias)
EditScript method | Edit a specific Visual FoxPro script. Syntax: EditScript(tcScriptName) Arguments: tcScriptName specifies the name of the Visual FoxPro script.
EditString method | Opens a string in an edit window. Syntax: EditString(tcString, tcTitle, tlNoEdit) Arguments: tcString specifies the string to edit. tcTitle specifies the name of the edit window. tlNoEdit specifies whether string is editable.
EraseTempFile method | Specifies whether to erase the current temporary file. Syntax: EraseTempFile( ) Return: none Arguments: none
FileToString method | Returns the string contents of a file. Syntax: FileString(tcFileName) Arguments: tcFileName specifies the name of the file from which to extract the string.
FrameBeforeNavigate method | Provides a FrameBeforeNavigate event. Syntax: FrameBeforeNavigate(URL, flags, targetframename, postdata, headers, cancel) Arguments: URL specifies the web page to use. flags specifies whether to addthe resource to the history list, to read or write from the cache, display the resource in a new window or a combination of these. targetframename specifies the name of the target frame. postdata specifies data to send to the HTTP Post transaction. headers specifies the HTTP headers to send. cancel specifies whether navigation was cancelled.
GetHTML method | Returns the HTML of the current document. Syntax: GetHTML(tcName, tcAlias) Arguments: tcName specifies the name of the document to return. tcAlias specifies the alias of cVFPScriptTable.
GetSourceFile method | Returns the file name of the current source document. Syntax: GetSourceFile( ) Arguments: none
GetSourceHTML method | Returns the HTML of the current source document. Syntax: GetSourceHTML( ) Arguments: none
GoBack method | Executes a hyperlink jump backward within the history list. Syntax: GoBack( ) Return: none Arguments: none
GoForward method | Executes a hyperlink jump forward within the history list. Syntax: GoForward( ) Return: none Arguments: none
Msgbox method | Message box handler method. Syntax: Msgbox(tcMessage, tnType,tcTitle) Arguments: tcMessage specifies the message to display. tnType specifies the messagebox type. tcTitle specifies the title of the messagebox.
NavigateComplete method | Provides a NavigateCompleteevent. Syntax: NavigateComplete(URL) Arguments: URL specifies the web page to navigate.
NewWindow method | Provides a NewWindowevent. Syntax: NewWindow(URL, flags, targetframename, postdata, headers, processed) Arguments: URL specifies the web page to use. flags specifies whether to addthe resource to the history list, to read or write from the cache, display the resource in a new window or a combination of these. targetframename specifies the name of the target frame. postdata specifies data to send to the HTTP Post transaction. headers specifies the HTTP headers to send. cancel specifies whether navigation was cancelled.
OpenTable method | Opens the specified table and activates it as the current table by setting the cAlias property. Syntax: OpenTable(tcFileName, tcAlias, tlExclusive, tcFilter) Arguments: tcFileName specifies the name of the table to open. tcAlias the alias of the table. tlExclusive specifies whether to open the table EXCLUSIVE. tcFilter specifies a filter expression to use.
OpenVFPScript method | Opens the Visual FoxPro script table. Syntax: OpenVFPScript( )
ParseSource method | Parses the source code of the HTML document. Syntax: ParseSource(URL, flags, targetframename, postdata, headers, cancel) Arguments: URL specifies the web page to use. flags specifies whether to addthe resource to the history list, to read or write from the cache, display the resource in a new window or a combination of these. targetframename specifies the name of the target frame. postdata specifies data to send to the HTTP Post transaction. headers specifies the HTTP headers to send. cancel specifies whether navigation was cancelled.
RefreshDeactivate method | Use when losing focus of the web browser control. Syntax: RefreshDeactivate( ) Arguments: none
RefreshMode method | Set refresh mode. Syntax: Refresh( ) Arguments: none
RefreshSource method | Refresh the source. Syntax: RefreshSource( ) Return: none Arguments: none
ReleaseHost method | Release the host form. Syntax: ReleaseHost( ) Arguments: none
RunAction method | Run action that is a specific method of the object referenced by the oAction property. Syntax: RunAction(tcMethod) Arguments: tcMethod specifies the method to run.
RunCode method | Run a specific block of Visual FoxPro code without compilation. Syntax: RunCode(tcCode) Arguments: tcCode specifies the Visual FoxPro code to run.
RunScript method | Run a specific Visual FoxPro script. Syntax: RunScript(tcScript, tcAlias) Arguments: tcScript specifies the script to run. tcAlias specifies the alias of the file containing tcScript.
SetBusyState method | Set busy state method. Syntax: SetBusyState(tlBusy) Arguments: tlBusy specifies whether a download is in process.
SetParam method | Set URL parameters method. Syntax: SetParam(tcParam) Arguments: tcParam
SkipRecord method | Skip record of currently selected table, based on cAlias. Syntax: SkipRecord(tnRecords) Arguments: tnRecords specifies the number of records to skip.
StringToFile method | Saves string contents to file. Syntax: StringToFile(tcText, tcFileName) Arguments: tcText specifies the text to save. tcFileName specifies the target file.
TrimExt method | Returns a file name without extension. Syntax: TrimExt(tcFileName, tlPlatformType) Return: cFilename Arguments: tcFileName specifies the filename to process. tlPlatformType specifies whether a file is from a DOS or Unix computer.
TrimFile method | Returns the path of the specified file name. Syntax: TrimFile(tcFileName, lPlatType) Arguments: tcFileName specifies the name of the target file. lPlatType specifies whether a file is from a DOS or Unix computer.
TrimPath method | Returns the file name without a path. Syntax: TrimPath(tcFileName, tlTrimExt, tlPlatformType) Arguments: tcFileName specifies name of the file. tlTrimExt specifies whether to remove the extension. tlPlatformType specifies whether a file is from a DOS or Unix computer.
ValidateURL method | Validates the URL. Syntax: ValidateURL(tcURL) Arguments: tcUrl specifies the web page to validate.
ValidURL method | Returns the validated URL. Syntax: ValidURL(tcURL) Arguments: tcUrl specifies the web page to return.
VFPS method | Executes a Visual FoxPro script based on the specified URL. Syntax: VFPS(tcCommand) Arguments: tcCommand specifies the Visual FoxPro expression to run.
VFPScript method | Executes a specific Visual FoxPro script. Syntax: VFPScript(tcName, tcAlias, tnCode) Arguments: tcName specifies the name of the file cVFPScript tcAlias specifies the alias of cVFPScriptTable tnCode specifies the Visual FoxPro code to run.
ViewSource method | View the source of the current document. Syntax: ViewSource(tlNoWait, tlNoEdit) Arguments: tlNoWait specifies whether the program pauses while the window displays. tlNoEdit specifies whether the viewed source is editable.
WaitWindow method | Wait window wrapper method. Syntax: WaitWindow(tcText, tlWait) Arguments: tcText specifies the text that displays in the Wait Window. tlWait specifies whether the program pauses while the window displays.
WildcardMatch method | Returns true (.T.) if the wild card string is matched to a specific string. Syntax: WildcardMatch(tcMatchExpList, tcExpressionSearched, tlMatchAsIs) Return: lMatch Arguments: tcMatchExpList specifies the search expression. tcExpressionSearched specifies the target expression tlMatchAsIs specifies whether to enforce an exact string match.


INI Access (VFP Foundation Class)

INI Access

See Also

Category | System Utilities
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Utilities
Class | oldinireg
Base Class | Custom
Class Library | Registry.vcx
Parent Class | registry

Remarks

This class provides a set of registry functions that access old INI-style file settings.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro places the class on the form. You can then specify the appropriate property values and provide any necessary input and output objects. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
GetINIEntry method | Retrieves information from INI entry. Syntax: GetINIEntry(cValue, cSection, cEntry, cINIFile) Arguments: cValue specifies the value to be applied to cEntry. cSection specifies the section of the .ini file in which cEntry occurs. cEntry specifies the item to be assigned cValue. cINIFile specifies the name of the .ini file.
GetINISection method | Retrieves information from INI section. Syntax: GetINISection(@aSections, cSection, cINIFile) Arguments: aSections specifies an array of cSections included in the .ini file. cSection specifies the section of cINIfile file to retrieve. cINIFile specifies the name of the .ini file.
LoadINIFuncs method | Loads functions needed for reading .ini files. Syntax: LoadINIFuncs( ) Return: none Arguments: none
WriteINIEntry method | Writes a specific INI entry. Syntax: WriteINIEntry(cValue, cSection, cEntry, cINIFile) Arguments: cValue specifies the new value. cSection specifies the section of cINIfile file to retrieve. cINIFile specifies the name of the .ini file.


Keywords Dialog Box (VFP Foundation Class)

Keywords Dialog Box

See Also

Category | Misc Forms
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Dialogs
Class | _keywords
Base Class | Form
Class Library | dialogs.vcx
Parent Class | _dialog
Sample | ...\Samples\Vfp98\Solution\Ffc\dialogs.scx

Remarks

This class creates a dialog that displays a specified list of keywords, like the Component Gallery keywords dialog.

To use, drop the class on a project or, from the Component Gallery Item Shortcut menu, select Create Form. When you drop the class on a project, you can choose between adding the class, creating a subclass, or creating a form. When you drop the class on a project or choose Create a new form from the selected class in the shortcut menu, Visual FoxPro opens a builder so you can specify the name of the form, then creates and opens the form in the Form Designer.

By default, the dialog uses the Component Gallery Keywords.dbf file. You can specify your own keywords file in the cTablename property. You can also provide a set of keywords in a comma-delimited list in the cKeywords property.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cKeywords property | Specifies a group of space-delimited keywords to seek in the table specified in cTablename. Default: ""
cTablename property | Specifies the name of a table that contains keywords. Default: (IIF(VERSION(2)=0,"",HOME( )+"gallery\")+"keywords.dbf"))
oKeywords object | The object that retrieves the list of keywords set to cKeywords property. Default: .F.
Apply method | Displays the keywords specified by the cKeywords property from the table specified in cTablename. Syntax: Apply( ) Return: none Arguments: none
lAddMode property | Internal to the class.
lUpdated property | Internal to the class.
cLastValue property | Internal to the class.


Launch Button (VFP Foundation Class)

Launch Button

See Also

Category | Misc Buttons
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Buttons
Class | _cmdLaunch
Base Class | CommandButton
Class Library | _miscbtns.vcx
Parent Class | _commandbutton
Sample | ...\Samples\Vfp98\Solution\Ffc\buttons.scx

Remarks

This button launches an application using the RUN command.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Form. When you add the class to a form, Visual FoxPro opens a builder so you can specify the appropriate cFileName value. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cFileName property | Specifies the name of the file to launch. Default: ""


Locate Button (VFP Foundation Class)

Locate Button

See Also

Category | Data Query
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Data Query
Class | _locatebutton
Base Class | CommandButton
Class Library | _table2.vcx
Parent Class | _dialogbutton
Sample | ...\Samples\Vfp98\Solution\Ffc\dataqry.scx

Remarks

This button displays a dialog to locate a record.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Form. When you add the class to a form, Visual FoxPro places a button that opens the Locate dialog. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.


Item Locator (VFP Foundation Class)

Item Locator

See Also

Category | Misc Forms
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Dialogs
Class | _locateitem
Base Class | Form
Class Library | _dialogs.vcx
Parent Class | _dialog
Sample | ...\Samples\Vfp98\Solution\Ffc\dialogs.scx

Remarks

This class provides a File Locator dialog box. It is designed to locate a file that your application needs but cannot find.

To use, drop the class on a project or, from the Item Shortcut menu, select Create Form or Create Form. When you drop the class on a project, you can choose between adding the class, creating a subclass, or creating a form. When you add the class to a form, Visual FoxPro displays an Open dialog box so you can specify the name of the form, then creates and opens the form in the Form Designer.

In the cDefaultFileName property, specify the file you want to retrieve. If the file is not located, the oLocateItem object opens a GetFile dialog so you can locate the file.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cDefaultFileName property | The name of the file to locate. Default: .NULL.
cFilename property | The file name retrieved from the Locate button. When no file is found, the GetFile dialog box appears. Default: .NULL.
oLocateItem object | An object reference that contains the return value set to the cFileName property. Default: .F.


Mail Merge Object (VFP Foundation Class)

Mail Merge Object

See Also

Category | Automation
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Automation
Class | mailmerge
Base Class | Custom
Class Library | mailmrge.vcx
Parent Class | automation
Sample | ...\Samples\Vfp98\Solution\Ffc\Automate.scx

Remarks

This Custom class uses the Mail Merge Wizard engine to generate a Microsoft Word Mail Merge document.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, specify the FROM table (cDataPath), the location and version of Word (cExe and cWordVersion), and other appropriate properties values. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
aWPMrg[2,0] property | An array of procedures for handling various merge styles. Default: .F.
cDataFile property | A FoxPro 2.6 copy of a Visual FoxPro 3.0 or later table. Default: ""
cDataPath property | Specifies the path to the FROM table. Default: ""
cDataSrc property | Specifies the data source for the ODBC connection. Default: ""
cDocName property | Default: "" Specifies the name of the existing .doc file.
cExe property | Specifies the full path to the Word application. Default: ""
cODBCSource property | Specifies the ODBC connection string. Default: ""
cSaveFile property | Specifies the file for holding merged data. Default: ""
CSQLstmt property | A SQL statement for extracting data. Default: ""
CSQLstmt2 property | Specifies an additional SQL statement, if cSQLStmt is greater than 255 characters (for Word). Default: ""
cWordVersion property | Specifies the version of Word that is installed (for example, '8'). Default: ""
lAlerted property | Specifies whether a failure alert was issued. Default: .F.
lEnglish property | Verifies whether Word recognizes English Word Basic commands. Default: .F.
lHasVerWord property | Verifies the presence of Word. Default: .F.
nNewDoc property | Indicates whether a new document will be used (see Mailmrge.h). Default: 1
nTemplate property | Specifies the main document type. Applies to Word only. See Mailmrge.h. Default: 1
nWordProc property | Specifies the selected word processor. See Mailmrge.h. Default: 1
SysCh property | Specifies a DDE channel. Default: -1
CheckVer method | Verifies the version of Word being used. Internal to the class. Syntax: CheckVer( ) Return: none Arguments: none
GetMSW method | Retrieves the Word command line from the registry. Syntax: GetMSW(m.cversion) Return: the full path to Word Arguments: m.cversion specifies the version of Word being used.
MrgCommaDel method | Generates a comma-delimited text file from data. Syntax: MrgCommaDel( ) Return: a comma-delimited file Arguments: none
MrgWord method | Determines the versions of Word to be used in the merge. Syntax: MrgWord( ) Return: none Arguments: none
MSWerr method | The error handler for use while AppleScript is being run. Syntax: MSWerr( ) Return: none Arguments: none
GetSQLst method | Retrieves the SQL statement for extracting data. Internal to the class. Syntax: GetSQLst( ) Return: none Arguments: none
PrepData method | Determines the kind of data source that is being used for the mail merge and normalizes the data for processing, Internal to the class. Syntax: PrepData( ) Return: none Arguments: none
SaveSQL method | Generates a table of SQL results. Internal to the class. Syntax: SaveSQL( ) Return: none Arguments: none
WzMMData method | Copies data to a text file. Internal to the class. Syntax: WzMMData( ) Return: none Arguments: none
MakeFieldList | Internal to the class.
MailMergeWord8 | Internal to the class.
MailMergeWord6 | Internal to the class.
MSWmldlg | Internal to the class.
Startword | Internal to the class.
MailMergeMacWord6 | Internal to the class.
MMCleanup method | Closes files - Internal to the class.


Messagebox Handler (VFP Foundation Class)

Messagebox Handler

See Also

Category | Misc Forms
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Utilities
Class | _msgbox
Base Class | Custom
Class Library | _dialogs.vcx
Parent Class | _custom

Remarks

This class provides a simple wrapper around the MessageBox function so you can easily display a message box of a specified type with alternate contents.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, specify the appropriate values for the message (cMessage), the type of message box (nType), and other appropriate properties. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cMessage property | Specifies the message box message text. Default: ""
nType property | Specifies the message box type. For options, see MessageBox( ). Default: 48
cTitle property | Specifies the message box title text. Default: _screen.caption
lBeep property | Specifies whether a beep occurs when message box is activated. Default: .F.
Show method | Displays a message box and returns the dialog box result. Syntax: Show(tcMessage, tnType, tcTitle, tlBeep) Return: this.Display( ) Arguments: tcMessage specifies the text that appears in the dialog box. tnType specifies the buttons and icons options, the default button, and the behavior of the dialog box. tcTitle specifies the text that appears in the title bar of the dialog box. tlBeep specifies whether an alert sound accompanies the display of the dialog box.
Set method | Sets the properties for the dialog box message, type, title, and alert sound. Internal to the class. Syntax: Set(tcMessage, tnType, tcTitle, tlBeep, tnParameters) Return: none Arguments: tcMessage specifies the text that appears in the dialog box. tnType specifies the buttons and icons options, the default button, and the behavior of the dialog box. tcTitle specifies the text that appears in the title bar of the dialog box. tlBeep specifies whether an alert sound accompanies display of the dialog box.


MouseOver effects (VFP Foundation Class)

MouseOver Effects

See Also

Category | User Interface
Default Catalog | Visual FoxPro Catalog\Foundation Classes\User Controls
Class | _mouseoverfx
Base Class | Custom
Class Library | _ui.vcx
Parent Class | _custom
Sample | ...\Samples\Vfp98\Solution\Ffc\mousefx.scx

Remarks

This class highlights a contol as the mouse is dragged over it.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, specify the appropriate values for the highlight (iHighlightColor and nHighlightWidth), and other appropriate properties, then place a reference to the HighlightMe method in the MouseMove event of the control you want to affect. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
nMargin property | Specifies the border between the control and the highlight. Default: 2
iShadowColor property | Specifies the color code of the shadow. Default: 0
lMouseoverHost property | Specifies whether the mouse is over the mousefx host. Default: .T.
nHighlightWidth property | Specifies the width of the highlight. Default: 2
iHighlightColor property | Specifies the color code of the highlight. Default: 0
CancelHighlight method | Uses the value of lMouseoverHost to determine whether there is a highlighted object requiring change. Sets oCurrentCoolControl to .NULL. and Returns true (.T.) when lMouseOver indicates that the current control has just changed. Your subclasses can check this return value or the state of lMouseOverHost and oCurrentCoolControl to "subtract" their own special effects from cool controls at the appropriate times. Syntax: CancelHighlight (toObject) Return: lChange Arguments: toObject specifies the object affected upon the MouseOver event. lChange specifies whether the current control has already changed.
HighlightMe method | Sets .oCurrentCoolControl, the current control, to the object reference specified by toObject. Returns true (.T.) when it has to act because the current control has just changed. Returns .F. if it doesn't need to act because there is no change in the current control. Your subclasses can use the oCurrentCoolControl property and the return value of this method to decide when they have to act, providing other special effects, perhaps specific for some special classes of "current controls". Syntax: HighlightMe(toObject) Return: lChange Arguments: toObject specifies the object affected upon the MouseOver event. lChange specifies whether the current control has already changed.
oCurrentCoolControl property | Internal to the class. Default: ""


VCR Picture navigation Buttons (VFP Foundation Class)

VCR Picture Navigation Buttons

See Also

Category | Data Navigation
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Data Navigation
Class | _nav4picbuttons
Base Class | Container
Class Library | _table2.vcx
Parent Class | _nav4buttons
Sample | ...\Samples\Vfp98\Solution\Ffc\datanav.scx

Remarks

This is a set of data navigation buttons that displays VCR pictures on the Top, Next, Previous, and Bottom buttons.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form in a data environment, you need to specify the appropriate input and output objects. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.


VCR Buttons (VFP Foundation Class)

VCR Buttons

See Also

Category | Data Navigation
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Data Navigation
Class | _nav4buttons
Base Class | Container
Class Library | _table.vcx
Parent Class | _nav2buttons
Sample | ...\Samples\Vfp98\Solution\Ffc\datanav.scx

Remarks

This set of record navigation buttons is a subclass of _nav2buttons that includes Top, Next, Prev, and Bottom navigation buttons.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form in a data environment, you need to provide appropriate input and output objects. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.


Navigation Shortcut menu (VFP Foundation Class)

Navigation Shortcut Menu

See Also

Category | Menus
Default Catalog | Visual FoxPro Catalog\Foundation Classes\User Controls
Class | _navmenu
Base Class | Container
Class Library | _table2.vcx
Parent Class | _container
Sample | ...\SamplesVfp98\Solution\Ffc\datasort.scx

Remarks

This is a shortcut menu that can be dropped onto a form with items for common data navigation, sorting, filtering and finding options. You call this class from the RightClick event of a form.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro prompts you to automatically add the necessary code to implement the shortcut menu. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cClass property | Specifies the class of the dialog containing the shortcut menu. Default: ""
cClasslib property | Specifies the class library containing the class of the dialog containing the shortcut menu. Default: ""
DoMenu method . | Runs a menu routine. Syntax: Domenu( ) Return: none Arguments: none
RefreshForm method | Refreshes the active form when data is updated. Syntax: RefreshForm( ) Return: none Arguments: none
DeleteRecord method | Deletes the current record. Syntax: DeleteRecord( ) Return: none Arguments: none
AddRecord method | Adds a new record. Syntax: AddRecord( ) Return: none Arguments: none
DoFilter method | Displays a filter dialog box. Syntax: DoFilter( ) Return: none Arguments: none
DoGoto method | Displays a GoTo dialog box. Syntax: DoGoto( ) Return: none Arguments: none
DoSort method | Displays a Sort dialog box. Syntax: DoSort( ) Return: none Arguments: none
DoDialog method | Displays a dialog box. Syntax: DoDialog( ) Return: none Arguments: none
SetMenu method | Specifies the menu contents through code containing AddMenuBar( ) expressions. Syntax: SetMenu( ) Return: none Arguments: none
DoFilter2 method | Displays an Advanced Filter dialog box. Syntax: DoFilter2( ) Return: none Arguments: none


Navigation Toolbar (VFP Foundation Class)

Navigation Toolbar

See Also

Category | Data Navigation
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Data Navigation
Class | _navtoolbarclass
Base Class | Container
Class Library | _table2.vcx
Parent Class | _container
Sample | ...\Samples\Vfp98\Solution\Ffc\datasort.scx

Remarks

This class provides a set of data navigation buttons and other controls in a toolbar.

To use, drop the class on a project or form in a data environment or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro automatically makes the connections. When you drop the class on a project, you can choose between adding the class or creating a subclass.

This class differs from navigation buttons by providing an output window as well as navigation buttons.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
oToolbar property | Internal to the class.
cClassLib property | Internal to the class.
cClass property | Internal to the class.
nLastTop property | Internal to the class.
nLastLeft property | Internal to the class.
lDocked property | Internal to the class.


Object State (VFP Foundation Class)

Object State

See Also

Category | Application
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Application
Class | _objectstate
Base Class | Custom
Class Library | _app.vcx
Parent Class | _custom
Sample | ...\Samples\Vfp98\Solution\Ffc\environ.scx

Remarks

This class determines the state of an object. It saves and/or restores object property settings automatically or explicitly.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, provide any necessary input and output objects. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
aProperties[1,3] property | The array for saving/restoring properties of oObject. Default: .F.
lAutomatic property | Specifies whether oObject properties are saved and restored. If this attribute is true (.T.), the _ObjectState object will restore all the attributes you've saved for its target object when the _ObjectState object is destroyed. Default: .F.
oObject | Reference to the target object whose state is being saved. Default: .NULL.
Restore method | Restores the value of a property for oObject if the value has changed. If tcWhichProperty is not passed, all saved properties of oObject are restored. (This method is called with no argument in the _ObjectState.Destroy( ) event when _ObjectState.lAutomatic is true (.T.). Syntax: Restore(tcWhichProperty) Return: tcSave Arguments: tcWhichProperty specifies the property to be restored. tcSave specifies the value to be restored.
Save method | Saves the current value of a property for oObject. You can use this instead of the tlSave argument of the Set method. Syntax: Save(tcProperty, tcTypeValue) Return: none Arguments: tcProperty specifies the property being accessed. tcTypeValue specifies the value being saved for tcProperty.
Set method | Sets a property to a new value for oObject. Syntax: Set(tcProperty, tvValue, tlSave) Return: Arguments: tcProperty specifies the property to set. tvValue specifies the value tcProperty is to be set to. tlSave specifies whether the current value is retained for later restoration.


ODBC Registry (VFP Foundation Class)

ODBC Registry

See Also

Category | System Utilities
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Utilities
Class | _odbcreg
Base Class | Custom
Class Library | registry.vcx
Parent Class | registry
Sample | ...\Samples\Vfp98\Solution\WinAPI\regodbc.scx

Remarks

This class provides a set of registry functions that return ODBC-specific information such as drivers and data sources.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro places the class on the form. You can then specify the appropriate property values and provide any necessary input and output objects. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
LoadODBCFuncs method | Loads the ODBC registry functions. Syntax: LoadODBCFuncs( ) Return: none Arguments: none
GetODBCDrvrs method | Retrieves ODBC drivers. Syntax: GetODBCDrvrs(@aDrvrs, lDataSources) Return: nRetVal Arguments: aDrvrs specifies, in an array, the drivers to retrieve. lDataSources specifies whether to access datasources.
EnumODBCDrvrs method | Enumerates through ODBC drivers. Syntax: EnumODBCDrvrs(@aDrvrOpts, cODBCDriver) Return: aDrvrOpts, m.cSourceKey, HKEY_LOCAL_MACHINE, .F. Arguments: aDrvrOpts specifies available driver options. cODBCDriver specifies the driver name.
EnumODBCData method | Enumerates through ODBC data sources. Syntax: EnumODBCData(@aDrvrOpts, cDataSource) Return: aDrvrOpts, m.cSourceKey, HKEY_CURRENT_USER, .F.) Arguments: aDrvrOpts specifies available driver options. cDataSource specifies the name of the data source.


Offline switch (VFP Foundation Class)

Offline Switch

See Also

Category | Data Editing
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Data Query
Class | _offline
Base Class | Container
Class Library | _dataquery.vcx
Parent Class | container

Remarks

The Offline switch works in a database containing remote views. This class provides a set of buttons that toggle between use of online and offline data.

To use, drop the class on a project or form in a data environment or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro places the class buttons on the form, and opens a builder so you can specify lUseCurrentDBC, lAllViews, lUpdateViews, and lRevertOnFail values. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cDatabase property | Specifies the name of the database containing views to take offline. Default: .F.
cViews[1,0] property | Specifies the array of views to process. Default: .F.
lAllViews property | Specifies whether to automatically use all views in the database. Default: .F.
lRevertOnFail property | Secifies whether to revert all views if one fails when going offline. Default: .T.
lUpdateViews property | Specifies whether to update all views when going online. Default: .T.
lUseCurrentDBC property | Specifies whether to use the currently opened database at the start. Default: .T.
GoOffLine method | Takes the views specified in the cViews array offline. Syntax: GoOffline( ) Return: none Arguments: none
GoOnLine method | Takes the views specified in the cViews array online. Syntax: GoOnline( ) Return: none Arguments: none
CheckOffLine method | Checks to see if views are currently online/offline. Syntax: CheckOffline( ) Return: none Arguments: none
Alert method | Displays a message box containing cMessage. Syntax: Alert(cMessage) Return: m.cMessage Arguments: cMessage specifies the text of the alert message.


OK Button (VFP Foundation Class)

OK Button

See Also

Category | Misc Buttons
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Buttons
Class | _cmdOK
Base Class | CommandButton
Class Library | _miscbtns.vcx
Parent Class | _commanbutton
Sample | ...\Samples\Vfp98\Solution\Ffc\buttons.scx

Remarks

This class releases a form and updates any outstanding buffered data.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Form. When you add the class to a form, Visual FoxPro places a button on your form. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.


Password Dialog Box (VFP Foundation Class)

Password Dialog Box

See Also

Category | Misc Forms
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Dialogs
Class | _login
Base Class | Form
Class Library | _dialogs.vcx
Parent Class | _form
Sample | ...\Samples\Vfp98\Solution\Ffc\dialogs.scx

Remarks

This class is a simple password login dialog box for custom applications.

To use, drop the class on a project or, from the Component Gallery Item Shortcut menu, select Create Form or Add to Project. When you drop the class on a project, you can choose between adding the class, creating a subclass, or creating a form. If you choose Create a new form from the selected class, Visual FoxPro opens a builder so you can specify the name of the login form, then creates and opens the form in the Form Designer.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cAlias property | Specifies the alias of the password table. Default: ""
cFieldName property | Specifies the name of field containing the user name. Default: ""
cPassword property | Specifies the name of the field containing the user password. Default: ""
cTable property | Specifies the name of table containing the user password information. Default: ""


PivotTable (VFP Foundation Class)

Pivot Table

See Also

Category | Automation
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Automation
Class | pivottable
Base Class | Custom
Class Library | pivtable.vcx
Parent Class | automation
Sample | ...\Samples\Vfp98\Solution\Ffc\Automate.scx

Remarks

This Custom class uses the PivotTable Wizard engine to generate an Excel Pivot Table from FoxPro data.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form in a data environment, Visual FoxPro opens a builder so you can specify the cPivFldCol, cPivFldRow, cPivFldPage, cPivFldData, lHasColumnTotals, and lHasRowTotals values. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
CheckState property | Specifies whether to test the state of Microsoft Excel through an error routine. Default: .F.
cOutfile property | Specifies the name of the output file. Default: ""
cPivFldCol property | Specifies the name of the field that identifies each pivot table column. Default: ""
cPivFldData property | Specifies the name of the field reported as pivot table data. Default: ""
cPivFldPage property | Specifies the name of the field that determines the pivot table pages. Default: ""
cPivFldRow property | Specifies the name of the field whose values identify each pivot table row. Default: ""
lHasColumnTotals property | Specifies whether to total columns. Default: .F.
lHasRowTotals property | Specifies whether to total rows. Default: .F.
nAction property | Specifies the output action to perform. Output action: 1 = Microsoft Excel worksheet 2 = Visual FoxPro form Default: 1
GetXLPath method | Queries the registry for the existence of Microsoft Excel. Syntax: GetXLPath( ) Return: none Arguments: none
MSQueryCheck method | Queries the registry for the existence of MS Query. Syntax: MSQueryCheck( ) Return: none Arguments: none
PivotOutput method | Creates a Microsoft Excel pivot table output. Syntax: PivotOutput( ) Return: none Arguments: none
aFldList[1,1] property | Internal to the class.
cFormName property | Internal to the class.
cFormSCX property | Internal to the class.
CheckFldLen method | Internal to the class.
GetDOSName method | Internal to the class.
lHasMSQry32 property | Internal to the class.
lHasNoTask property | Internal to the class.
lIsNumeric property | Internal to the class.
SkipError property | Internal to the class.


QBF (VFP Foundation Class)

QBF

See Also

Category | Data Query
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Data Query
Class | _qbf
Base Class | Container
Class Library | _dataquery.vcx
Parent Class | _container
Sample | ...\Samples\Vfp98\Solution\Forms\qbf.scx

Remarks

This class provides a button set for Query-By-Form querying.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro places the QBF command buttons on the form. You can then specify the appropriate property values and provide any necessary input and output objects. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
QBF_Table property | Specifies the table on which to run the query. Default: ""
ParseCondition( )method | Specifies a filter based on a query. Syntax: ParseCondition(cCondition, cControlSource) Return: lcRetCondition Arguments: cControlSource specifies the data bound to the control. cCondition specifies the query expression.


Registry Access (VFP Foundation Class)

Registry Access

See Also

Category | System Utilities
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Utilities
Class | registry
Base Class | Custom
Class Library | registry.vcx
Parent Class | registry
Sample | ...\Samples\Vfp98\Solution\WinAPI\regfox.scx

Remarks

This class provides access to information in the Windows Registry.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro places the class on the form. You can then specify the appropriate property values and provide any necessary input and output objects. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
CloseKey method | Closes a registry key. Syntax: CloseKey( ) Return: none Arguments: none
DeleteKey method | Deletes a registry key. Syntax: DeleteKey(nUserKey, cKeyPath) Return: none Arguments: nUserKey specifies the Registry User key. cKeyPath specifies the Registry User key path.
DeleteKeyValue method | Deletes a value from a registry key. Syntax: DeleteKeyValue(cOptName, cKeyPath, nUserKey) Return: Arguments: cOptName specifies the name of the Registry key option. cKeyPath specifies the path to the Registry key. nUserKey specifies the User key.
EnumKeys method | Enumerates through a registry key. Syntax: EnumKeys(@aKeyNames) Return: Arguments: aKeyNames specifies the Registry keys to enumerate.
EnumKeyValues method | Enumerates through values of a registry key. Syntax: EnumKeyValues(@aKeyValues) Return: Arguments: aKeyValues specifies the Registry User key values to enumerate.
EnumOptions method | Enumerates through all entries for a key and populates an array with values. Syntax: EnumOptions(@aRegOpts, cOptPath, nUserKey, lEnumKeys) Return: Arguments: aRegOpts specifies the Registry key option. cOptPath specifies the path to the Registry key option. nUserKey specifies the User key ID. lEnumKeys specifies whether to enumerate other options, if they exist.
GetKeyValue method | Returns the value for a key. Syntax: GetKeyValue(cValueName, cKeyValue) Return: Arguments: cValueName specifies the name of the value to retrieve. cKeyValue specifies the value of cValueName.
GetRegKey method | Returns a registry key setting. Syntax: GetRegKey(cOptName, cOptVal, cKeyPath, nUserKey) Return: Arguments: cOptName specifies the name of the Registry key option. cOptVal specifies the value to apply to the option. cKeyPath specifies the Registry key path. nUserKey specifies the User key.
IsKey method | Returns whether a specified key exists. Syntax: IsKey(cKeyName, nRegKey) Return: Arguments: cKeyName specifies the name of the user ley to check, if it exists. nRegKey specifies the Registry key ID
OpenKey method | Opens a registry key. Syntax: Open(cLookUpKey, nRegKey, lCreateKey) Return: Arguments: cLookUpKey specifies the name of the user key for which to search. nRegKey specifies the Registry key ID lCreateKey specifies whether to create a new Registry key if the specified one does not exist.
SetKeyValue method | Sets the value of a registry key. Syntax: SetKeyValue(cValueName, cValue) Return: Arguments: cValueName specifies the name of the value to set. cValue specifies the value to apply to cValueName.
SetRegKey method | Sets the registry key setting. Syntax: SetRegKey(cOptName, cOptVal, cKeyPath, nUserKey) Return: Arguments: cOptName specifies the name of the Registry key option. cOptVal specifies the value to apply to the option. cKeyPath specifies the Registry key path. nUserKey specifies the User key ID.
cAppPathKey property | Internal to the class.
cIniDllFile property | Internal to the class.
cODBCDllFile property | Internal to the class.
cRegDllFile property | Internal to the class.
cVfpOptPath property | Internal to the class.
lCreateKey property | Internal to the class.
lHadError property | Internal to the class.
lLoaddedDlls property | Internal to the class.
lLoadedInis property | Internal to the class.
lLoadedOdbcs property | Internal to the class.
nCurrentKey property | Internal to the class.
nCurrentOS property | Internal to the class.
nUserKey property | Internal to the class.
LoadRegFuncs method | Internal to the class.


Output object (VFP Foundation Class)

Output Object

See Also

Category | Reporting
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Output
Class | _output
Base Class | Container
Class Library | _reports.vcx
Parent Class | _container
Sample | ...\Samples\Vfp98\Solution\Ffc\output.scx

Remarks

This is a generic reporting object that provides a variety of report source and destination options from reports and labels or directly from a data source.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro places the class on the form. You can then specify the appropriate property values and provide any necessary input and output objects. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
aDestinations[1,2] property | The array of destinations. Default: .F.
aOptions[1,2] property | The array of destination output options. Default: .F.
cAlias property | Specifies the data source that is used for non-report/label output formats. This property defaults to the current alias, if any. Default: ""
cDestination property | Specifies a list of available destinations that changes dynamically, depending on whether cReport, cAlias, or both contain values. The list of available destinations is stored in the aDestinations array. Default: "PRINTREPORT"
cDisplayFontName property | Specifies an on-screen font for output; for example, when you issue BROWSE or when the _Showtext class is instantiated for text display. Default: Courier New
cFieldList property | Specifies a comma-delimited list of fields or expressions. It affects only direct data sources (BROWSEs and LISTs). Default: ""
cHtmlClass property | Specifies an optional HTML class and class library passed to _GENHTML. Default: ""
cHtmlstyleid property | Specifies an optional HTML style passed to _GENHTML. Default: ""
cOption property | Specifies the list of available options that changes dynamically to fit the current cDestination. Default: WINDEFAULT
cReport property | Specifies a label or report form suitable for Visual FoxPro-formatted output. Default: ""
cScope property | Specifies a macro-expanded string to be added to the command that executes the actual output. It must be a valid scope such as "FOR lExpression". Default: ""
cTextfile property | Specifies the file name for all output destinations that go to disk, which include text files, printer-image files, and export formats. Default: ""
cVFPPrinterName property | Specifies the name of the current Visual FoxPro default printer as distinct from the Windows default printer. Default: ""
lAddSourceNameToDropdown property | Specifies whether some destinations display in the aDestinations array. Default: .T.
lPreventSourceChanges property | Prevents source changes for cAlias or cReport. Default: .F.
CopyTable method | Exports a table. Syntax: CopyTable( ) Return: Arguments:
GenHTML method | Generates HTML code by calling the Genhtml.prg program. Syntax: GenHTML( ) Return: none Arguments: none
Output method | Specifies the main method that is called to generate output based on settings. Syntax: Output(liSelect) Return: Arguments: liSelect specifies the output destination.
OutputToScreen method | Outputs to the screen. Syntax: OutputToScreen( ) Return: none Arguments: none
SetDestinations method | Evaluates the current environment to populate an array of output destinations. Syntax: SetDestinations( ) Return: lSuccess Arguments: none
SetOptions method | Evaluates the current environment to populate an array of options for output destinations. Syntax: SetOptions( ) Return: lSuccess Arguments: none
cAlias_assign method | Internal to the class.
cDestination_assign method | Internal to the class.
cDisplayFontName_assign method | Internal to the class.
cOption_assign method | Internal to the class.
cReport_assign method | Internal to the class.
cScope_assign method | Internal to the class.
cVFPPrinterName_access method | Internal to the class.
lPreventSourceChanges_assign method | Internal to the class.
PrintList method | Internal to the class.
PrintReport method | Internal to the class.
SetOutputPrinter method | Internal to the class.
SetVFPPrinter method | Internal to the class.


Output control (VFP Foundation Class)

Output Control

See Also

Category | Reporting
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Output
Class | _outputchoices
Base Class | Container
Class Library | _reports.vcx
Parent Class | _output
Sample | ...\Samples\Vfp98\Solution\Ffc\output.scx

Remarks

This class provides controls that prompt you for a reporting output option. Using the Report object, it also allows you to select which report to print.

To use, drop the class on a project or form in a data environment or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro places the class on the form. You can then provide any necessary input and output objects. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.


Output dialog (VFP Foundation Class)

Output Dialog Box

See Also

Category | Reporting
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Output
Class | _outputdialog
Base Class | Form
Class Library | _reports.vcx
Parent Class | _form
Sample | ...\Samples\Vfp98\Solution\Ffc\output.scx

Remarks

This class uses the Report object to display a dialog box that prompts the user for a reporting output option.

To use, drop the class on a project or, from the Component Gallery Item Shortcut menu, select Create Form. When you drop the class on a project, you can choose between adding the class, creating a subclass, or creating a form. If you choose Create a new form, Visual FoxPro opens a builder so you can specify the name of the form, then creates and opens the form in the Form Designer.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cAlias property | Specifies the name of the data source to output. Default: ""
cDestination property | Specifies the list of available destinations that changes dynamically depending on whether cReport, cAlias, or both, contain values. Default: ""
cDisplayFontName property | Specifies the name of an on-screen display of output; for example, when you issue BROWSE or when the _Showtext class is instantiated for text display. Default: .F.
cFieldList property | Specifies a comma-delimited list of fields or expressions. It affects only direct data sources (BROWSEs and LISTs). Default: ""
cHTMLClass property | Specifies an optional HTML class and class library passed to _GENHTML. Default: ""
cHTMLStyleID property | Specifies an optional HTML style passed to _GENHTML. Default: .F.
cReport property | Specifies the name of report or label to output. Default: ""
cScope property | Specifies a valid scope expression for output. Default: .F.
lAddSourceNameToDropdown property | Specifies whether some destinations display in the aDestinations array. Default: .F.
lPreventScopeChanges property | Specifies whether you can change output scope. Default: .F.
lPreventSourceChanges property | Specifies whether source changes for cAlias or cReport are prevented. Default: .F.
cAlias_access method | Internal to the class.
cAlias_assign method | Internal to the class.
cDestination_access method | Internal to the class.
cDestination_assign method | Internal to the class.
cDisplayFontName_access method | Internal to the class.
cDisplayFontName_assign method | Internal to the class.
cFieldList_access method | Internal to the class.
cFieldList_assign method | Internal to the class.
CheckOKButton method | Internal to the class.
cHTMLClass_access | Internal to the class.
cHTMLClass_assign | Internal to the class.
cHTMLStyleID_access | Internal to the class.
cHTMLStyleID_assign | Internal to the class.
cReport_access method | Internal to the class.
cReport_assign method | Internal to the class.
cScope_access method | Internal to the class.
cScope_assign method | Internal to the class.
lAddSourceNameToDropdown_access method | Internal to the class.
lAddSourceNameToDropdown_assign method | Internal to the class.
lPreventScopeChanges_assign method | Internal to the class.
lPreventSourceChanges_access method | Internal to the class.
lPreventSourceChanges_assign method | Internal to the class.
RespondToPermissionForScopeChanges method | Internal to the class.
RespondToPermissionForSourceChanges method | Internal to the class.


Preview report (VFP Foundation Class)

Preview Report

See Also

Category | Misc Buttons
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Buttons
Class | _cmdRunReport
Base Class | CommandButton
Class Library | _miscbtns.vcx
Parent Class | _commandbutton
Sample | ...\Samples\Vfp98\Solution\Ffc\buttons.scx

Remarks

This class provides a generic button to run a report directly or through the Output dialog class.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Form. When you add the class to a form, Visual FoxPro opens a builder so you can specify the cFileName and lSetCaption values. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cDialogClass property | Specifies the output dialog box class. Default: _OutputDialog
cDialogClasslib property | Specifies the output dialog box class library. Default: (IIF(VERSION(2)=0,"",HOME( )+"FFC\")+"_REPORTS.VCX"))
cFilename property | Specifies the name of the form to run. Default: ""
cOutputDialogAlias property | Specifies the name of the output dialog box alias. Default: ""
lOutputDialogPreventScope property | Specifies whether to prevent changing the scope in dialog box. Default: .F.
lOutputDialogPreventSource property | Specifies whether to prevent changing the alias/report in dialog box. Default: .F.
lPromptForReport property | Specifies whether to ask for a report name. Default: .T.
lSetCaption property | Specifies whether caption is automatically based on the value of cFilename. Default:.T.
lUseOutputDialog property | Specifies whether to display the foundation class Output dialog box. Default:.T.
ShowOutputDialog method | Displays the foundation class Output dialog box. Syntax: ShowOutputDialog( ) Return: none Arguments: none


SCX->HTML (VFP Foundation Class)

SCX->HTML

See Also

Category | Internet
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Internet
Class | _scx2html
Base Class | Custom
Class Library | _internet.vcx
Parent Class | _custom
Sample | ...\Samples\Vfp98\Solution\Ffc\dohtml.scx

Remarks

This class converts a Visual FoxPro form (.scx) to HTML. This class provides properties to control the scope, visual layout, and HTML generation. For more information, see Genhtml.prg.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro opens a builder so you can accept the current values or specify the appropriate cSource, cOutFile, and nGenOutput values. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cOutfile property | Specifies the name of the HTML file to output. Default: ""
cScope property | Specifies the scope (for example, NEXT or ALL, for the output). Default: ""
cSource property | Specifies the source .scx file from which to generate the HTML file. Default: ""
cStyle property | Specifies the visual style as listed in the ID field of Genhtml.dbf. Default: ""
lAutonameoutput property | Specifies whether _GENHTML to automatically names the output file based on its source. Default: .T.
nGenOutput property | Specifies the _GENHTML output option. 0 = Generate an output file. 1 = Generate and display an output file in Visual FoxPro editor. 2 = Generate and display an output file in Internet Explorer. 3 = Generate and display an output file after displaying a Save As dialog box. 4 = Create a PUBLIC _oHTML object and generate a file. 5 = Create a PUBLIC _oHTML object without generating a file. Default: 2
GenHTML method | Generates HTML code by calling the _GENHTML engine using properties specified in cSource, cOutFile, and nGenOutput. Syntax: GenHTML( ) Return: none Arguments: none


SendMail Buttons (VFP Foundation Class)

SendMail Buttons

See Also

Category | Misc Buttons
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Buttons
Class | _mailbtn
Base Class | Container
Class Library | _miscbtns.vcx
Parent Class | _container
Sample | ...\Samples\Vfp98\Solution\OLE\sendmail.scx

Remarks

This class, which uses the MAPI ActiveX Control, handles sending a mail message from a form. When dropped on a form, it can be used to send the current record directly to your mail application.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you drop the class on a form in a data environment, Visual FoxPro places a button on your form where it will access the current record of the active form. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
logSession property | Specifies whether login to mail was successful. Default: .F.
SignOn method | Attempts to login to mail. Syntax: SignOn( ) Return: none Arguments: none
AddTabs method | Internal to the class.


Shell Execute (VFP Foundation Class)

Shell Execute

See Also

Category | System utility
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Utilities
Class | _shellexecute
Class Library | _environ.vcx
Parent Class | _custom
Sample | ...\Samples\Vfp98\Solution\OLE\Buttons.scx

Remarks

This class enables you to launch an application or document with its associated application from the current application.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro places the class on the form. You can then specify the appropriate property values and provide any necessary input and output objects. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
ShellExecute method | Attempts to run the file tcFileName in the directory, tcWorkDir. Syntax: ShellExecute(tcFileName, tcWorkDir, tcOperation) Return: nSuccess Arguments: tcFileName specifies the file to run. tcWorkDir specifies the path to the file to run. tcOperation specifies the operation to perform. nSuccess specifies the failure or the success of the run attempt using one of the following values. 2 = Bad Association (for example, invalid URL) 29 = Failure to load application 30 = Application is busy 31 = No application association Values over 32 represent success, and return an instance handle for the running application.


Shortcut Menu class (VFP Foundation Class)

Shortcut Menu Class

See Also

Category | Menus
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Menus
Class | _shortcutmenu
Base Class | Custom
Class Library | _menu.vcx
Parent Class | _custom
Sample | ...\Samples\Vfp98\Solution\Ffc\newmenu.scx

Remarks

When placed on a project or form, this class dynamically creates shortcut popup menus.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro places the class on the form. You can then specify the appropriate property values and provide any necessary input and output objects. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cOnSelection property | Specifies the menu bar selection routine. Default: ""
cMenu property | Specifies the name of the shortcut menu. Default: ""
DeactivateMenu method | Deactivates the existing shortcut menu. Syntax: DeactivateMenu( ) Return: none Arguments: none
ActivateMenu method | Activates the existing shortcut menu. Syntax: ActivateMenu(tcParentMenu) Return: Arguments: tcParentMenu specifies the name of the menu from which the shortcut is activated.
ClearMenu method | Releases the existing shortcut menu. Syntax: ClearMenu( ) Return: none Arguments: none
NewMenu method | Creates a new menu popup for the shortcut menu. Syntax: NewMenu( ) Return: none Arguments: none
AddMenubar method | Adds a new menu bar to the shortcut menu. Syntax: AddMember(tcPrompt, tcOnSelection, tcClauses, tnElementNumber, tlMark, tlDisabled, tlBold) Return: none Arguments: tcPrompt specifies the item label. tcOnSelection specifies the action performed by selecting the item. tcClauses specifies any command clause for the item. tnElementNumber specifies the location of the element in the array. tlMark specifies whether to use the default mark character. tlDisabled specifies whether the menu item is disabled. tlBold specifies whether the item is bold.
AddMenuSeparator method | Adds a separator to the shortcut menu. Syntax: AddMenuSeparator(tnElementNumber) Return: none Arguments: tnElementNumber specifies the position the separator occupies in the menu.
ShowMenu method | Displays the existing shortcut menu. Syntax: ShowMenu( ) Return: none Arguments: none
SetMenu method | Releases the current shortcut menu in order to create a new one. Syntax: SetMenu(toObject) Return: none Arguments: toObject specifies the name of the new shortcut menu.
aMenu[1,0] property | Internal to the class.


Text preview (VFP Foundation Class)

Text Preview

See Also

Category | Reporting
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Output
Class | _showtext
Base Class | Form
Class Library | _reports.vcx
Parent Class | _form
Sample | ...\Samples\Vfp98\Solution\Ffc\output.scx

Remarks

When used on a project or form, this class provides a simple text editor in a dialog box that also contains buttons to format or save text, and to close the editor.

The main purpose of this class is to provide a controllable preview window to other classes in _reports.vcx. Therefore this dialog box has no button to load a new file (though you can add one in a subclass) and it defaults to read only for its edit box.

To use, drop the class on a project or, from the Component Gallery Item Shortcut menu, select Add to Project. When you drop the class on a project, you can choose between adding the class, creating a subclass, or creating a form. When you choose Create a new form from the selected class, Visual FoxPro opens a builder so you can specify the name of the form, then creates and opens the form in the Form Designer.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cFixedFontName property | The font name for contents of the edit box. Default: Courier New
nFixedFontSze property | The font size for contents of the edit box. Default: 9
cSourceFile property | The name of the source file to view or edit. Default: ""
cTargetFile property | The name of the file to which you save the contents of the edit box. Default: ""
lFixedFontBold property | Specifies a bold font for contents of the edit box. Default: .F.
lFixedFontiItalic property | Specifies an italic font for contents of the edit box. Default: .F.
lSuppressCaptionChange property | Prevents the dialog box caption from changing as the source file changes. This is useful for displaying the contents of a temporary file. Default: .F.
SetFonts method | Applies the current font property characteristics to the edit box displaying the file. Syntax: SetFonts( ) Return: none Arguments: none
GetFixedFont method | Uses a common dialog box to display fonts. Restricted to fixed font items. Syntax: GetFixedFont( ) Return: none Arguments: none
cTargetfile_access method | Internal to the class.
cSourcefile_assign method | Internal to the class.


Simple Edit Buttons (VFP Foundation Class)

Simple Edit Buttons

See Also

Category | Data Editing
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Buttons
Class | picformbtns
Base Class | Container
Class Library | wizbtns
Parent Class | gridbtns
Sample | ...\Samples\Vfp98\Solution\Ffc\dataedit2.scx

Remarks

When placed on a project or form, this class provides simple picture Add, Edit, Delete, Duplicate, Save, and Cancel buttons (as used by the Form Wizard). Use for simple forms based on a single table or view. For more information, view gridbtns in the Wizbtns.vcx class library in the Class Browser.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form in a data environment, Visual FoxPro places the class buttons on the form. You can then provide any necessary input and output objects. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.


Mover (VFP Foundation Class)

Mover

See Also

Category | Movers
Default Catalog | Visual FoxPro Catalog\Foundation Classes\User Controls
Class | _mover
Base Class | Container
Class Library | _mover.vcx
Parent Class | _container
Sample | ...\Samples\Vfp98\Solution\Ffc\movers.scx

Remarks

When placed on a project or form, this class provides a simple mover list box class with Move and Remove buttons.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro places the class list box controls and move buttons on the form. You can then specify the appropriate property values and provide any necessary input and output objects. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
aChoices[1,0] property | The array of available choices in the left list box. Default: .F.
aSelections[1,0] property | The array of selected items in the right list box. Default: .F.
UseArrays property | Specifies whether to use arrays for the list boxes. Default: .T.
InitChoices method | Initializes the choices array. Syntax: InitChoices(@aChoices) Return: none Arguments: aChoices specifies an array of initial choices.
InitSelections method | Initializes the selections array. Syntax: InitSelections(@aSelections) Return: none Arguments: aSelections specifies the array of initial selections.
GetSelections method | Retrieves the selected items. Syntax: GetSelections(@aSelections) Return: none Arguments: aSelections specifies the name of the array containing the target selections.
PopList method | The routine to populate list boxes. Syntax: PopList(@aListArray, oLstRef) Return: none Arguments: aListArray specifies the items with which to populate the list. oLstRef is a reference to the control object.
OldlSelectedItem property | Internal to the class.
OldrSelectedItem property | Internal to the class.
SortLeft property | Internal to the class.
Updated property | Internal to the class.
SizeToContainer method | Internal to the class.
ValidItem method | Internal to the class.


Simple Picture Navigation Buttons (VFP Foundation Class)

Simple Picture Navigation Buttons

See Also

Category | Data Navigation
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Data Navigation
Class | _nav2picbuttons
Base Class | Container
Class Library | _table2.vcx
Parent Class | _nav2buttons
Sample | ...\Samples\Vfp98\Solution\Ffc\datanav.scx

Remarks

When placed on a project or form, this class provides a pair of simple picture Next and Previous navigation buttons. For more details, open _nav2buttons in the _table.vcx class library in the Class Browser.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro places the command buttons on the form. You can then specify the appropriate property values and provide any necessary input and output objects. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.


Simple Navigation Buttons (VFP Foundation Class)

Simple Navigation Buttons

See Also

Category | Data Navigation
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Data Navigation
Class | _nav2Buttons
Base Class | Container
Class Library | _table.vcx
Parent Class | _container
Sample | ...\Samples\Vfp98\Solution\Forms\single.scx

Remarks

When placed on a project or form, this class provides a simple pair of Next and Previous navigation buttons.

To use, drop the class on a project or form in a data environment or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro places the command buttons on the form. You can then specify the appropriate property values and provide any necessary input and output objects. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
lCycle property | Specifies whether pointer movement continues when the bottom or top of the file is encountered. Default: .F.
TableNav method | Handles record navigation. Syntax: TableNav(tcAction) Return: none Arguments: tcAction specifies a navigation action such as Next or Previous.
lCycle_access method | Internal to the class.


Sort Dialog Button (VFP Foundation Class)

Sort Dialog Box Button

See Also

Category | Data Query
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Buttons
Class | _sortbutton
Base Class | CommandButton
Class Library | _table2.vcx
Parent Class | _dialogbutton
Sample | ...\Samples\Vfp98\Solution\Ffc\datasort.scx

Remarks

When placed on a project or form this class provides a button that displays a dialog box that allows you to sort data in ascending or descending order on a particular field. For details, open _dialogbutton in the _table2.vcx class library in the Class Browser.

To use, drop the class on a project or form in a data environment or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro places the button on the form. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.


Sort Dialog (VFP Foundation Class)

Sort Dialog Box

See Also

Category | Data Query
Default Catalog | Visual FoxPro\Foundation Classes\ Data Query
Class | _sortdialog
Base Class | Form
Class Library | _table2.vcx
Parent Class | _form
Sample | ...\Samples\Vfp98\Solution\Ffc\datasort.scx

Remarks

This dialog box enables you to perform an ascending or descending data sort on a particular field.

To use, drop the class on a project or, from the Component Gallery Item Shortcut menu, select Add to Project. When you drop the class on a project, you can choose between adding the class, creating a subclass, or creating a form. If you choose Create a new form from the selected class, Visual FoxPro opens a builder so you can specify the name of the form, then creates and opens the form in the Form Designer. You need to provide an indexed table for the Sort dialog box.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
DoSort method | Allows you to sort on the current field or to specify the field on which to order a table. Syntax: DoSort( ) Return: none Arguments: none


Sort Object (VFP Foundation Class)

Sort Object

See Also

Category | Data Query
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Data Query
Class | _tablesort
Base Class | Custom
Class Library | _table.vcx
Parent Class | _table
Sample | ...\Samples\Vfp98\Solution\Ffc\datasort.scx

Remarks

This class, when placed on a form, enables you to sort a datasource.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro places the class icon on the form. You can then specify the appropriate property values and provide any necessary input and output objects. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
lDescending property | Specifies whether the sort order is ascending or descending. Default: .F.
DoSort method | Allows you to sort on the current field or to specify the field on which to order a table or alias. Syntax: DoSort([tcField] [,tcAlias] [,tcTag] [,tlDescending]) Return: none Arguments: tcField specifies the field to sort on. tcAlias specifies the alias of the table to sort. tcTag specifies the index tag of the field, tcField. tlDescending specifies whether the sort is a descending sort.
GetSortTag method | Looks for an appropriate tag name by looking at key expressions in the table relevant to the field name. Syntax: Getsorttag(tcField, tcAlias) Return: lcTag Arguments: tcField specifies the field to sort on. tcAlias specifies the alias of the table to sort.
RemoveSort method | Removes the current index tag. Syntax: RemoveSort(tcAlias) Return: none Arguments: tcAlias specifies the alias of the table from which to remove the tag.


Sort Selector (VFP Foundation Class)

Sort Selector

See Also

Category | Data Query
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Data Query
Class | _sortselect
Base Class | Container
Class Library | _table2.vcx
Parent Class | _container
Sample | ...\Samples\Vfp98\Solution\Ffc\datasort.scx

Remarks

This set of buttons, when placed on a project or form, performs an ascending or descending sort based on the current control.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro places the buttons on the form. You can then specify the appropriate property values and provide any necessary input and output objects. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
DoSort method | Allows you to sort on the current field or to specify the field on which to order a table. Syntax: DoSort([tcField] [,tcAlias] [,tcTag] [,tlDescending]) Return: none Arguments: tcField specifies the field to sort on. tcAlias specifies the alias of the table to sort. tcTag specifies the index tag of the field, tcField. tlDescending specifies whether the sort is a descending sort.


Sort Mover (VFP Foundation Class)

Sort Mover

See Also

Category | Movers
Default Catalog | Visual FoxPro Catalog\Foundation Classes\User Controls
Class | _sortmover
Base Class | Container
Class Library | _mover.vcx
Parent Class | _mover
Sample | ...\Samples\Vfp98\Solution\Ffc\movers.scx

Remarks

This subclass of the mover list box class, when placed on a form, automatically handles sorting of data.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
CurrentAlias property | The current alias for field choices. Default: ""
CurrentDBC property | The current database for field choices. Default: ""
MaxFields property | Maximum number of fields allowed. Default: 3
ShowTags property | Specifies whether to show existing index tags in addition to fields. Default: .F.
aTags[1,1] property | Internal to the class.
TagName property | Internal to the class.
UpdateMover | Internal to the class.


Sound Player (VFP Foundation Class)

Sound Player

See Also

Category | Multimedia
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Multimedia
Class | _soundplayer
Base Class | Container
Class Library | _multimedia.vcx
Parent Class | _container
Sample | ...\Samples\Vfp98\Solution\Forms\mci_play.scx

Remarks

This class loads and plays a sound file, and provides access to the Media Control Interface (MCI).

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you drop the class on a project, you can choose between adding the class or creating a subclass. When you choose an option from the shortcut menu or drop the class on a form, Visual FoxPro opens a builder so you can specify appropriate cFileName, lAutoOpen, lAutoPlay, lAutoRepeat, and cControlSource values.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cControlSource property | Specifies the source of data to which an object is bound. Default: ""
cFileName property | Specifies the name of the sound file to play. Default: ""
cMCIAlias property | Specifies the alias for the video file when calling MCI commands. If empty, the name of the file is used. Default: ""
cMCIErrorString property | Stores the error string from the last MCI command. Default: ""
lAutoOpen property | Specifies whether the video file specified should be automatically opened when the class is created. Default: .T.
lAutoPlay property | Specifies whether the video file should automatically play after opening. Default: .T.
lAutoRepeat property | Specifies whether video plays continuously. Default: .T.
nMCIError property | Specifies the result of the last MCI command executed. Default: 0
CloseSound method | Closes the loaded sound file and releases its resources. Syntax: CloseSound( ) Return: none Arguments: none
OpenSound method | Opens the sound file. Syntax: OpenSound( ) Return: none Arguments: none
PauseSound method | Pauses the currently playing sound. Syntax: PauseSound( ) Return: none Arguments: none
PlaySound method | Plays the loaded sound file. Syntax:PlaySound( ) Return: none Arguments: none
SetPosition method | Allows the user to set the position of the media file. Syntax: SetPosition (cPosition) Return: none Arguments: cPosition specifies Start, End, or a number representing milliseconds into the media file.
DoMCI method | Internal to the class.
GetMCIError method | Internal to the class.
ShowMCIError method | Internal to the class.


Splash screen (VFP Foundation Class)

Splash Screen

See Also

Category | Misc Forms
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Dialogs
Class | _splash
Base Class | Form
Class Library | _dialogs.vcx
Parent Class | _form
Sample | ...\Samples\Vfp98\Solution\Ffc\dialogs.scx

Remarks

This class, when placed in an project, provides a simple Splash Screen for custom applications.

To use, drop the class on a project or, from the Component Gallery Item Shortcut menu, select Create Form or Add to Project. When you drop the class on a project, you can choose between adding the class, creating a subclass, or creating a form. When you choose Create a new form from the selected class, Visual FoxPro displays an Open dialog box so you can specify the name of the form, then creates and opens the form in the Form Designer.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
nDuration property | Specifies the duration (in seconds) to display the screen. Default: 3


SQL Pass Through (VFP Foundation Class)

SQL Pass Through

See Also

Category | Data Query
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Data Query
Class | _execsp
Base Class | Custom
Class Library | _dataquery.vcx
Parent Class | _custom

Remarks

This class is used for SQL Pass Through and allows you to execute stored procedures on a host database such as Microsoft SQL Server.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you drop the class on a form, Visual FoxPro places the class icon on the form. You can then specify the appropriate property values and provide any necessary input and output objects. When you drop the class on a project, you can choose between adding the class or creating a subclass.

You need to add code that specifies parameter and connection information so the class can return a result set in a cursor.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
lUseSQLSyntax | Specifies whether to use Server Exec syntax. Default: .F.
DoSQL method | Runs a SQL Pass Through statement. Syntax: DoSQL( ) Return: none Arguments: none
GetSQL method | Gets results from the SQL Pass Through statement. Syntax: GetSQL( ) Return: none Arguments: none
aParams[1,0] property | Internal to the class.
cCursorName property | Internal to the class.
cSpname property | Internal to the class.
cSQL property | Internal to the class.
hConnectHandle property | Internal to the class.
ProcessError method | Internal to the class.
SetParams method | Internal to the class.
SetSQL method | Internal to the class.


Stop Watch (VFP Foundation Class)

Stop Watch

See Also

Category | Date/Time
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Date/Time
Class | _stopwatch
Base Class | Container
Class Library | _datetime.vcx
Parent Class | _container
Sample | ...\Samples\Vfp98\Solution\Controls\Timer\swatch.scx

Remarks

This class, when placed on a form, provides a stop watch control.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro places the icon on the form where it will run on the active form. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
Increment method | Increments the stopwatch display. Syntax: Increment( ) Return: none Arguments: none
Reset method | Resets the stopwatch. Syntax: Reset( ) Return: none Arguments: none
Start method | Starts the stopwatch. Syntax: Start( ) Return: none Arguments: none
Stop method | Stops the stopwatch. Syntax: Stop( ) Return: none Arguments: none
UpdateDisplay method | Refreshes the display. Syntax: UpdateDisplay( ) Return: none Arguments: none


String Library (VFP Foundation Class)

String Library

See Also

Category | Data Utilities
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Utilities
Class | _stringlib
Base Class | Custom
Class Library | _utility.vcx
Parent Class | _custom

Remarks

This class removes carriage return and line feed characters from a character string.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
TrimCRLF method | Trims carriage return and line feed characters from a character string. Syntax: TrimCRLF (tcString, tlTrimLeft, tlTrimRight) Return: none Arguments: tcString specifies the string to trim. tlTrimLeft specifies whether to trim the left side. tlTrimRight specifies whether to trim the right side.


Super Mover (VFP Foundation Class)

Super Mover

See Also

Category | Movers
Default Catalog | Visual FoxPro Catalog\Foundation Classes\User Controls
Class | _supermover
Base Class | Container
Class Library | _mover.vcx
Parent Class | supermover
Sample | ...\Samples\Vfp98\Solution\Ffc\movers.scx

Remarks

This class, when placed on a form, provides a mover list box with Move, Remove, MoveAll, and RemoveAll buttons.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a project, you can choose between adding the class or creating a subclass. When you add the class to a form in a data environment, Visual FoxPro adds the class list box and button controls to the form in the Form Designer so you can specify appropriate property values.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
MaxItems property | Specifies the maximum number of items that can be selected. Default: 0
MaxMessage property | Specifies the message to display if maximum number of items is reached. Default: ""


System Toolbar (VFP Foundation Class)

System Toolbar

See Also

Category | Application
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Application
Class | _systoolbars
Base Class | Custom
Class Library | _app.vcx
Parent Class | _custom
Sample | ...\Samples\Vfp98\Solution\Ffc\environ.scx

Remarks

This class is a manager class that handles and tracks System Toolbars so you can automatically remove the Visual FoxPro system toolbars in your application and later restore them. This class is used with the framework generated by the Application Wizard.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a project, you can choose between adding the class or creating a subclass. When you add the class to a form, Visual FoxPro places the icon on the form. You can then specify the appropriate property values and provide any necessary objects.

If lAutomatic is true (.T.), as in a READEVENTS-type application, the class automatically hides all existing system toolbars when you instantiate it. It then automatically restores the system toolbars hidden when it went out of scope.

You can also call the HideSystemToolbars( ) and ShowSystemToolbars( ) methods manually.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
lAutomatic property | Automatically hides and restores system toolbars for the application. Default: .F.
aSystemToolbars[1,0] property | The array of system toolbars. Default: .F.
Hidesystemtoolbars method | Manually hides system toolbars for the application. Syntax: Hidesystemtoolbars( ) Return: none Arguments: none
Showsystemtoolbars method | Manually shows system toolbars for the application. Syntax: Showsystemtoolbars( ) Return: none Arguments: none
Initializetoolbararray method | Internal to the class.


Table Mover (VFP Foundation Class)

Table Mover

See Also

Category | Movers
Default Catalog | Visual FoxPro Catalog\Foundation Classes\User Controls
Class | _tablemover
Base Class | Container
Class Library | _mover.vcx
Parent Class | _fieldmover
Sample | ...\Samples\Vfp98\Solution\Ffc\movers.scx

Remarks

This subclass of the field mover list box class automatically loads tables and fields from the current datasource.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a project, you can choose between adding the class or creating a subclass. When you add the class to a form, Visual FoxPro opens a builder so you can accept or specify the appropriate cDBCTable, cDBCName, SkipGeneral, SkipMemo, AllowReadOnly, and AllowQuery values on the form in the Form Designer.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
AllowQuery property | Specifies whether to allow queries. Default: .F.
AllowViews property | Specifies whether to allow views. Default: .T.
ExclDBF property | Specifies the name of the table to exclude from the list. Default: ""
ViewNoData property | Specifies whether to show view information without retrieving data. Default: .T.
GetDBCAlias method | Retrieves the database file (.dbc) alias. Syntax: GetDBCAlias(cDBC) Return: none Arguments: cDBC specifies the database alias.
GetDBCData method | Retrieves database table fields. Syntax: GetDBCData(cDBCName) Return: data fields Arguments: cDBCName specifies the name of the database.
GetDBCName method | Retrieves the database name. Syntax: GetDBCName( ) Return: none Arguments: none
GetDBCTable method | Retrieves the database table. Syntax: GetDBCTable(cDBCTable) Return: none Arguments: cDBCTable specifies the short name of the table
GetFreeData method | Retrieves free table fields. Syntax: GetFreeData( ) Return: none Arguments: none
MoverRefresh method | Refreshes movers. Syntax: MoverRefresh(lRefresh, lQuickPass, cSaveLstValue) Return: none Arguments: lRefresh specifies whether to repopulate listboxes and popups. lQuickPass specifies whether to restore if the environment is unchanged. cSaveLstValue specifies the value to restore.
OpenTable method | Opens the datasource. Syntax: OpenTable( ) Return: none Arguments: none
UseTable method | Handles what table is opened with USE and whether the table is opened exclusively. Syntax: UseTable(cGetDBF, lUseExcl) Return: none Arguments: cGetDBF specifies the table to use. lUseExcl specifies whether the table is opened exclusively.
ExclusiveSet method | Internal to the class.
RefreshCurrent method | Internal to the class.
TableChange method | Internal to the class.


RTF controls (VFP Foundation Class)

RTF Controls

See Also

Category | Text Format
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Text Formatting
Class | _rtfcontrols
Base Class | Container
Class Library | _format.vcx
Parent Class | _container
Sample | ...\Samples\Vfp98\Solution\Toolbars\format.scx

Remarks

This class, when placed on a form, provides controls for applying font formatting to text in the active control.

To use, drop the class on a project or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a project, you can choose between adding the class or creating a subclass. When you add the class to a form, Visual FoxPro places the comboboxes and button controls on the form in the Form Designer.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.


Format toolbar (VFP Foundation Class)

Format Toolbar

See Also

Category | Text Format
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Text Formatting
Class | _tbrediting
Base Class | Toolbar
Class Library | _format.vcx
Parent Class | _toolbars
Sample | ...\Samples\Vfp98\Solution\Toolbars\format.scx

Remarks

This class, when placed on a form, provides a toolbar for applying font formatting to text in the active control.

To use, drop the class on a project or, from the Component Gallery Item Shortcut menu, select Add to Project. When you add the class to a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
nAppliesTo property | Specifies the scope of the formatting. 1 = apply to the selected control 3 = apply to all controls Default: 1


Thermometer (VFP Foundation Class)

Thermometer

See Also

Category | User Interface
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Dialogs
Class | _thermometer
Base Class | Form
Class Library | _therm.vcx
Parent Class | _thermometer
Sample | ...\Samples\Vfp98\Solution\Ffc\therm.scx

Remarks

This class, when placed on a form, provides a standard thermometer class.

To use, drop the class on a project or, from the Component Gallery Item Shortcut menu, select Add to Project. When you drop the class on a project, you can choose between adding the class, creating a subclass, or creating a form. If you choose Create a new form from the selected class, Visual FoxPro displays the Open dialog box so you can specify the name of the form, then creates and opens the form in the Form Designer. You need to specify appropriate property values in the Update method.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cCurrentTask property | Specifies the current task. Default: ""
iBasis property | Specifies the basis for calculating the percentage. Default: 0
iPercentage property | Specifies the percentage completion at which the display updates. Default: 0
iProgress property | Specifies the amount completed(iPercentage). Default: 0
Complete method | Displays 100% complete thermometer. Syntax: Complete(m.cTask) Return: none Arguments: m.cTask specifies what to display when progress is complete.
Update method | Updates the thermometer. Syntax: Update(iProgress, cTask) Return: none Arguments: iProgress specifies the progress increment. cTask specifies the message to be displayed.
cThermRef property | Internal to the class.
ShpThermBarMaxWidth property | Internal to the class.


Trace Aware Timer (VFP Foundation Class)

Trace Aware Timer

See Also

Category | Application
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Application
Class | _traceawaretimer
Base Class | Timer
Class Library | _app.vcx
Parent Class | _timer
Sample | ...\Samples\Vfp98\Solution\Ffc\environ.scx

Remarks

This is an application utility that detects whether the trace window is open and handles debug timing appropriately. Although Visual FoxPro allows you to skip tracing timer events altogether when debugging, this isn't always an appropriate solution because sometimes the code in timer events is pertinent to what you're trying to debug. Instead, this timer determines whether any of the debugging window is visible and if so, sets a special slow interval.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Form. When you add the class to a project, you can choose between adding the class or creating a subclass. When you add the class to a form, Visual FoxPro places an icon on the form. You can then specify the appropriate property values and provide any necessary input and output objects. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
iRegularInterval property | Specifies the standard interval period. Stored during the Init event, and restored during Timer events if you've changed the Interval. Default: 0
iTraceInterval property | Specfies a slower interval period to use while debugging. Default: 10000


Type library (VFP Foundation Class)

Type Library

See Also

Category | File Utilities
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Utilities
Class | _typelib
Base Class | Container
Class Library | _utility.vcx
Parent Class | _container
Sample | ...\Samples\Vfp98\Solution\Forms\typelib.scx

Remarks

This class contains the FOXTLIB ActiveX Control which reads type infos from type libraries. The main routine ExportTypeLib creates a text file with Type library output.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a project, you can choose between adding the class or creating a subclass. When you add the class to a form, Visual FoxPro places the class icon on the form. You can then specify the appropriate property values on the form in the Form Designer.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
aTypeAttr[1,0] property | Specifies the array for the TypeAttr structure. Default: .F.
aTypeFuncDesc[1,0] property | Specifies an array for the FuncDesc structure. Default: .F.
aTypeFuncDocs[3,0] property | Specifies an array for function documentation. Default: .F.
aTypeFuncNames[1,0] property | Specifies an array of function names. Default: .F.
aTypeFuncParms[1,0] property | Specifies an array of the function parameters. Default: .F.
aTypeInfoDocs[3,0] property | Specifies an array for TypeInfo documentation. Default: .F.
aTypeLibDocs[3,0] property | Specifies an array for TypeLib documentation. Default: .F.
FuncNamesCount property | Specifies the number of names for TypeInfo function. This is equivalent to total parameters+1. Default: .F.
TypeInfoCount property | Specifies the number of TypeInfos in TypeLib. Default: .F.
TypeInfoIndex property | An index reference to TypeInfo. Default: .F.
TypeLibHandle property | The handle to TypeLib. Default: .F.
TypeLibName property | Specifies the name of the type library. Default: .F.
ExportTypeLib method | Exports contents of a TypeLib to a text file. Syntax: ExportTypeLib(cExportFile, lViewFile) Return: m.exportfile Arguments: cExportFile specifies the file to export. lViewFile specifies whether to open the file in a viewer after export.
GetDataType method | Returns data type of function. Syntax: GetDataType(m.nvt) Return: name of data type Arguments: m.nvt Specifies a data item reference.
GetFuncDesc method | Obtains TypeInfo function info and populates arrays. Syntax: GetFuncDesc(nFuncIndex) Return: TypeInfo arrays, aTypeFuncParms, aTypeFuncNames, aTypeFuncDocs Arguments: nFuncIndex specifies the index of the function.
GetTypeInfo method | Obtains TypeInfo and populates TypeInfo arrays. Syntax: GetTypeInfo(nTypeInfoNum) Return: none Arguments: nTypeInfoNum specifies a reference to the Typeinfo key.
GetTypeLib method | Obtains TypeLib info and populates arrays. Syntax: GetTypeLib( ) Return: none Arguments: none


URL combo (VFP Foundation Class)

URL Combo

See Also

Category | Internet
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Internet
Class | _urlcombobox
Base Class | Combobox
Class Library | _internet.vcx
Parent Class | _combobox
Sample | ...\Samples\Vfp98\Solution\hyperlnk.scx

Remarks

This class, when placed on a form, creates a combo box for entering a Web URL. It launches Internet Explorer and navigates to the site.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you drop the class on a project, you can choose between adding the class or creating a subclass. When you dropn the class on a form, Visual FoxPro opens a builder so you can specify the appropriate cURL, cURLHistoryTable, and iURLHistory values on the form in the Form Designer. You can use the history table to supply one or more start locations for web navigation.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cURL property | The current URL. Default: ""
cURLHistoryTable property | Specifies the name of the URL history table that retains previously accessed URLs. Default: (IIF(VERSION(2)=0,"",HOME( ))+"URLHstry.dbf"))
lInitialized property | Control initialized flag. Default: .F.
lURLHistory property | Saves URL history. Default: .T.
Navigate method | Requests the document based on URL address. Syntax: Navigate( ) Return: none Arguments: none
cHyperlinkClass property | Internal to the class.
cHyperlinkclasslibrary property | Internal to the class.
cTempFilePrefix property | Internal to the class.
lDropDown property | Internal to the class.
lFormNavigate property | Internal to the class.
lGotFocus property | Internal to the class.
lMoveFocus property | Internal to the class.
lRequestOnEnter property | Internal to the class.
oHyperlink property | Internal to the class.
Initialize method | Internal to the class.
oHyperlink_access method | Internal to the class.
OpenURLHistory method | Internal to the class.
ValidURL method | Internal to the class.


URL Open Dialog Box (VFP Foundation Class)

URL Open Dialog Box

See Also

Category | Internet
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Internet
Class | _openaddressdialog
Basse Class | Form
Class Library | _internet.vcx
Parent Class | _dialog
Sample | ...\Samples\Vfp98\Solution\Ffc\hyperlnk.scx

Remarks

This dialog, when placed on a form, provides a dropdown that stores the URL history list.

To use, drop the class on a project or, from the Component Gallery Item Shortcut menu, select Add to Project or Create Form. When you add the class to a project, you can choose between adding the class or creating a subclass, or creating a form. When you create a form, Visual FoxPro displays an Open dialog box so you can specify the name of the form, then creates and opens the form in the Form Designer so you can specify appropriate Target and lShellExecute values.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
lShellExecute property | Runs the target URL. Default: .T.
Target property | Specifies the name of the target URL. Default: ""
cFileExt property | Internal to the class.


Guidelines for Using Visual FoxPro Foundation Classes

See Also

The Visual FoxPro .vcx visual class libraries located in the \Ffc\ folder contain a variety of foundation classes for enhancing your Visual FoxPro applications with little or no programming. You can freely distribute the foundation classes with your applications. These foundation classes are contained in the Component Gallery. The Component Gallery provides a quick and easy way to learn more about the properties, events, and methods of each of the foundation classes.

You can also open up a foundation class in the Class Designer or Class Browser to see its structure and code. This is a great way to learn how the foundation class works as well as offering excellent insights into programming with Visual FoxPro.

The following guidelines provide information about how you can add the Visual FoxPro foundation classes to your applications.

Class Types

You need to know the Visual FoxPro base class of a foundation class before you can add the foundation class to your application. Certain foundation classes can be used only as visual objects on forms, while others are non-visual and can be run programmatically without being placed on a form. The Visual FoxPro Foundation Classes documentation indicates the base class of each foundation class so you can determine if the foundation class can be added to a form, or run programmatically in your application. Note that in the Component Gallery you can right-click a foundation class to display a shortcut menu. Choose Properties from the shortcut menu, and then choose the Class tab to display the base class.

The following table lists the Visual FoxPro base classes and how they can be added to your applications.

Category A – base classes that can be dropped onto a form. | Category B – base classes that can be dropped onto a form or run programmatically in your application. | Category C – base classes that can only be run programmatically in your application.
Checkbox | Custom | Form
Combobox | Container | Formset
Commandbutton | Timer | Toolbar
Commandgroup | ProjectHook |
Editbox | ActiveDoc |
Grid |  |
Hyperlink |  |
Image |  |
Label |  |
Line |  |
Listbox |  |
OLE Control |  |
Optionbutton |  |
Optiongroup |  |
Shape |  |
Spinner |  |
Textbox |  |

Adding Foundation Classes to Forms

You will most often add foundation classes to forms. You can drag and drop foundation classes from the Component Gallery, Class Browser, Project Manager, and the Forms Control toolbar onto forms.

Note You can select a foundation class you’ve added to a form and then choose Class Browser from the Tools menu to display more information about the foundation class.

Component Gallery – The Component Gallery provides the easiest way to add foundation classes to a form. For foundation classes with Category A and B base classes, you can drag the foundation class from the Component Gallery and then drop it on a form. You can also right-click a foundation class in the Component Gallery to display a shortcut menu, and then choose Add to Form to add the foundation class to the form.

Some of the foundation classes have associated builders that are automatically launched to prompt you for more information needed by the foundation class.

Class Browser – You can drag foundation classes with Category A and B base classes directly from the Class Browser to a form by using the drag icon in the upper left corner of the Class Browser. Select the foundation class in the Class Browser, click the icon for the foundation class in the upper left corner of the Class Browser, and then drag the icon over the form. Release the mouse button over the form where you’d like the foundation class to appear on the form.

Foundation classes dragged from the Class Browser to a form do not launch the associated builder. However, you can launch the builder by after the foundation class has been dropped on the form. Select the foundation class on the form, and then right-click to display the shortcut menu. Choose Builder from the shortcut menu to launch the builder.

Project Manager – Foundation classes with Category A and B base classes can be dragged from the Project Manager and dropped on a form.

Foundation classes dragged from the Project Manager to a form do not launch the associated builder. However, you can launch the builder by after the foundation class has been dropped on the form. Select the foundation class, and then right-click to display the shortcut menu. Choose Builder from the shortcut menu to launch the builder.

Form Controls toolbar – Foundation classes with Category A and B base classes added to the Form Controls toolbar can be added to a form.

If the Builder Lock isn’t on, foundation classes dropped from the Form Controls toolbar may launch an associated builder. If the Build Lock is on, you can launch the builder by after the foundation class has been added to the form. Select the foundation class on the form, and then right-click to display the shortcut menu. Choose Builder from the shortcut menu to launch the builder.

Adding Foundation Classes to Projects

When a form containing foundation classes is added to a Visual FoxPro project, the Project Manager automatically adds the visual class libraries containing the foundation classes to the project. However, there are other cases where you may need to add foundation classes to a project. For example, your application may run a Category C foundation class, so the foundation class must be added to the application’s project.

Foundation classes can be added to a project from the Component Gallery, by dragging the .vcx visual class library containing the foundation classes from the Windows Explorer, or by choosing the Add button in the Project Manager.

Adding Foundation Classes from the Component Gallery

You can drag a foundation class from the Component Gallery to a project, or you can right-click the foundation class in the Component Gallery to display a shortcut menu, and then choose Add to Project to add the foundation class to the project. When you add a foundation class to a project, the Add Class to Project dialog box is displayed, prompting you with the following options:

Add class to project

Choose this option to add the foundation class and its .vcx class library to the project. Again, this is done automatically for classes dropped onto a form (Categories A and B). For certain Category B and C classes where you plan to call them programmatically from within your application, you will want to choose this option.

Create a new class from selected class

Choose this option to create a new subclass from the foundation class you want to add to the project. This option allows you to enhance the functionality of the original foundation class, usually by adding additional program code.

Create a new form from selected class

Choose this option for foundation classes with a Form base class (for example, the foundation classes in _dialogs.vcx). This option allows you to create a new form from the foundation class and enhance the functionality of the original foundation class.

Adding Foundation Classes from the Windows Explorer

A foundation class can be added to a project by dragging the .vcx visual class library containing the foundation class from the Window Explorer to the Project Manager. The visual class library is added to the Class Libraries item in the Project Manager.

Adding Foundation Classes from within the Project Manager

A foundation class can be added to a project by selecting the Classes tab and then choosing the Add button. Select the class library from the \Ffc\ folder that contains the foundation class to add to the project.

Incorporating Classes into your Application

In many situations, most foundation classes don’t require additional programming to work with your application. However, you may need to provide additional program code for certain foundation classes (those of Category B and Category C non-visual base classes).

Non-Visual Foundation Classes

For example, foundation classes are often based on the Category B Custom class, and these require additional programming. These non-visual classes often perform common tasks such as checking information in the Windows registry, handling environment settings, managing application errors, and utilizing Automation with other applications, such as performing mail merge with Microsoft Word.

You can drop these non-visual classes onto a form, but you will need to do some additional work in order for them to work with your application. In some cases, a builder is launched when you drag a foundation class onto a form.

The following example demonstrates some of the program code typically necessary to use a non-visual foundation class in your application:

  1. Drag the File Version foundation class from the Component Gallery (Foundation Classes\Utilities folder) onto a form.

  2. Add a command button to the form and add the following code to its Click event:
    WITH THISFORM._FILEVERSION1
.cFileName = HOME( )+ 'VFP6.EXE'
.GetVersion( )
.DisplayVersion( )
ENDWITH
  3. Run the form and click the command button.

You can incorporate a non-visual class in your application without dropping it on a form, as long as you include it in the project used to create the application. The following code illustrates how to executed this same File Version foundation class if the class is not dropped onto a form.

LOCAL oFileVersion
oFileVersion = NewObject(_fileversion, _utilities.vcx)
WITH oFileVersion
.cFileName = HOME( )+ 'VFP6.EXE'
.GetVersion( )
.DisplayVersion( )
ENDWITH

Note This example assumes that the code can locate the _utilities.vcx class library or from an .app file that is built containing _utilities.vcx.

When you use a non-visual foundation class, you need to know how and when the class is used within your application so it can be scoped correctly. If only a single form uses the class, you can just drag the class onto the form. However, if the class is used by many forms or is used globally by the application, the foundation class should have a global scope in the application so it remains accessible throughout the application. A global scope may also improve performance.

Visual Foundation Classes

You can also programmatically add visual foundation classes, such as those with form base classes, to your application. The following example shows how you can add code to your application to display an Aboutbox dialog.

LOCAL oAbout
oAbout = NewObject(_aboutbox,_dialogs.vcx)
oAbout.Show( )

You can create a subclass of the dialog box foundation class for each of your applications so that you can customize the contents of the dialog box for each application. The following example demonstrates how you can subclass the Aboutbox foundation class:

  1. Drag and drop the Aboutbox class from the Component Gallery (Foundation Classes\Dialogs folder) to the project for your application.

  2. Select Create new form from selected class in the Add Class to Project dialog box that is displayed, and enter name for the form.

  3. Change the Caption property for the new form for your application. Save and close the form.

  4. Add program code (DO FORM FormName) to the procedure that runs the form, such as an About menu item procedure.

    -or-

Drag the Run Form button class from the Component Gallery (Foundation Classes\Buttons folder) onto the form. A builder is launched, and you can specify the name of the form to execute.

If you use the Visual FoxPro 6.0 Application Framework, the Application Builder automatically handles adding forms (both .scx and .vcx form classes). The new Application Wizard or the Component Gallery New Application item installs this framework in the projects they create. The Application Builder interacts directly with the framework and enables you to specify how and where the form is launched.

By using a framework built with the Application Wizard, the Application Builder, and Component Gallery, you have a rich set of tools for creating entire applications with minimal manual coding.

Class Naming Conventions

The Visual FoxPro Foundation classes and their properties and methods use the following naming conventions.

Classes and Class Libraries

Most foundation classes are subclassed from classes in the _base.vcx visual class library, which you can also find in the \Ffc\ folder. The naming conventions for these classes reflect the base class used. For example, a subclass of the Custom class is called _Custom in _base.vcx. All classes use an underscore ( _ ) to preface the name of a class in _base.vcx.

A few class libraries do not contain classes that are subclassed from _base.vcx because these classes are shared with other Visual FoxPro components such as wizards and builders. These classes are contained in class libraries without a preceding underscore, such as Registry.vcx.

Methods and Properties

Methods are often based on an action name such as RunForm. If the name contains several words, for example, RunForm, then capitalization reflects this. Properties are usually prefaced with a single letter characterizing the data type of that particular property. For example, cFileName indicates that the property is of character type. In addition, default values for properties are also set to the appropriate data type. For example, a logical property can be initialized to false (.F.), while a numeric property can be initialized to 0.

Properties of classes that shipped in earlier versions of Visual FoxPro do not strictly adhere to these property naming conventions, and retain their earlier names to avoid compatibility conflicts with user code referencing these properties.

Enhancing or Modifying FoxPro Foundation Classes

You can enhance or modify the Visual FoxPro foundation classes to meet the needs of your application. However, we recommend that you do not modify the foundation classes themselves. The foundation classes may be periodically updated with new functionality.

Subclassing the Foundation Class

The source code is provided for the foundation classes, so you can subclass any foundation class to override or enhance properties and methods. This choice is common when the behavior of a particular foundation class varies between different applications. One application might use a foundation class directly, while another application uses a subclass of the foundation class.

Updating _base.vcx

If you want to add global changes to the Visual FoxPro foundation classes, you can modify _base.vcx. Since foundation classes are subclassed from _base.vcx, changes to this class library are automatically propagated to the foundation classes. A common set of methods and properties are provided for all the classes in _base.vcx. However, you can alter the classes in _base.vcx if they add desired behavior to your applications (unlike the foundation classes that we recommend that you do not change).

Instead of changing _base.vcx, however, you should redefine the classes in _base.vcx to inherit their behavior from your own custom base classes (rather than from the Visual FoxPro base classes currently used). If you already have a custom class library which subclasses the Visual FoxPro base classes, you can redefine the classes in _base.vcx to inherit from your custom classes so that when components use the _base classes they will inherit from your custom classes too. You can use the Class Browser to redefine the parent class for a particular class.

If you replace the entire _base.vcx class with your own, make sure that you have the same set of named classes, otherwise the foundation classes will have missing links.


Video Player (VFP Foundation Class)

Video Player

See Also

Category | Multimedia
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Multimedia
Class | _videoplayer
Base Class | Container
Class Library | multimedia.vcx
Parent Class | _container
Sample | ...\Samples\Vfp98\Solution\Forms\mci_play.scx

Remarks

This class loads and plays a video file, and provides access to the Media Control Interface (MCI).

To use, drop the class on a project or form, or from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you drop the class on a project, you can choose between adding the class or creating a subclass. When you choose an option from the shortcut menu or drop the class on a form, Visual FoxPro opens a builder so you can specify appropriate cFileName, lAutoOpen, lAutoPlay, lAutoRepeat, and cControlSource values.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
AutoOpen property | Specifies whether the video file specified should be automatically opened when the class is created. Default: .T.
AutoPlay property | Specifies whether the video file should automatically play after opening. Default: .T.
AutoRepeat property | If true (.T.), specifies that the video file will play continuously. Default: .T.
cFileName property | Specifies the video file associated with the Video Frame. Default: ""
Controlsource property | Specifies the source of data to which an object is bound. Default: ""
MCIAlias property | Specifies the alias for the video file when calling MCI commands. If empty, the name of the file is used. Default: ""
MCIError property | Specifies the result of the last MCI command executed. Default: 0
MCIErrorString property | Stores the error string from the last MCI command executed. Default: ""
CloseVideo method | Closes the video file and releases all resources. Syntax: CloseVideo( ) Return: none Arguments: none
DoMCI method | Executes an MCI command. Syntax: DoMCI(cMCIcmd) Return: cRetString Arguments: cMCIcmd specifies the command to run.
PauseVideo method | Pauses a currently playing video. Syntax: PauseVideo( ) Return: none Arguments: none
PlayVideo method | Plays the currently loaded video. Syntax: PlayVideo( ) Return: none Arguments: none
SetPosition method | Allows the user to set the position of the media file. Syntax: SetPosition(cPosition) Return: none Arguments: cPosition specifies Start, End, or a number representing millisecondsinto the media file.
GetMCIError method | Internal to the class.
OpenVideo method | Internal to the class.
ShowMCIError method | Internal to the class.


Visual FoxPro Foundation Classes

The Visual FoxPro Foundation Classes are provided with the Component Gallery as a way to provide rapid application development with as little coding as possible. The classes work immediately by addressing the following needs:

  • Provide common database development tools and structures

  • Provide fast, extensible generic components

  • Provide components that enhance and ease web page development

  • Provide effective wrappers for system API functions

  • Provide a rich set of functions to a wide range of Visual FoxPro users

Visual FoxPro Foundation Classes A-Z lists the foundation classes in alphabetical order. Many of these foundation classes are used in the Solutions sample located in the …\Samples\Vfp98\Solution folder. Also, Guidelines for Using Visual FoxPro Foundation Classes provides an overview of the situations and solutions in which to use foundation classes.


Foundation Classes A to Z List

Visual FoxPro Foundation Classes A-Z

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

A

About Dialog

ActiveX Calendar

Application Registry

Array Handler

B

C

Cancel Button

Clock

Conflict Catcher

Cookies Class

Cross Tab

D

Data Edit Buttons

Data Navigation Buttons

Data Session Manager

Data Validation

Data Navigation Object

DBF->HTML

Distinct Values Combo

E

Error Object

F

Field Mover

File Version

Filter Dialog Box Button

Filter Dialog Box

Filter Expression Dialog Box

Find Button

Find Dialog Box

Find Files/Text

Find Object

Find (Findnext) Buttons

Font Combobox

Font Size Combobox

Format Toolbar

FRX->HTML

G

GetFile and Directory

GoTo Dialog Box Button

GoTo Dialog Box

Graph By Record

Graph Object

H

Help Button

Hyperlink Button

Hyperlink Image

Hyperlink Label

I

Item Locator

INI Access

J

K

Keywords Dialog Box

L

Launch Button

Locate Button

Lookup Combobox

M

Mail Merge Object

Messagebox Handler

Mover

MouseOver Effects

N

Navigation Shortcut Menu

Navigation Toolbar

O

Object State

ODBC Registry

Offline Switch

OK Button

Output Object

Output Control

Output Dialog Box

P

Password Dialog Box

Pivot Table

Preview Report

Q

QBF

R

Registry Access

Resize Object

RTF Controls

Run Form btn

S

SCX->HTML

SendMail Buttons

Shell Execute

Shortcut Menu Class

Simple Edit Buttons

Simple Picture Navigation Buttons

Simple Navigation Buttons

Sort Dialog Box Button

Sort Dialog Box

Sort Object

Sort Selector

Sort Mover

Sound Player

Splash Screen

SQL Pass Through

Stop Watch

String Library

Super Mover

System Toolbar

T

Table Mover

Text Preview

Thermometer

Trace Aware Timer

Type Library

U

URL Combo

URL Open Dialog Box

V

VCR Buttons

VCR Picture Navigation Buttons

Video Player

W

Web Browser Control

Window Handler

X

Y

Z


WindowHandler (VFP Foundation Class)

Window Handler

See Also

Category | Application
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Application
Class | _windowhandler
Base Class | Custom
Class Library | _ui.vcx
Parent Class | _custom
Sample | ...\Samples\Vfp98\Solution\Ffc\whandler.scx

Remarks

This general purpose Window Handler class performs several common window operations such as cascading windows.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a project, you can choose between adding the class or creating a subclass. When you add the class to a form, Visual FoxPro displays the icon on the form so you can specify appropriate properties values its available methods in the Form Designer.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
IMDIWorkspaceColorproperty Contains the Windows color for top-level frame window.
Default: 0
CascadeFormInstances method Cascades forms.
Syntax: CascadeFormInstances(tcFormName, tlOmitAutoCenteredForms, tnStartTop, tnStartLeft, tnStartColumn)
Return: none
Arguments:
tcFormName specifies the form or _screen in which to cascade forms.
tlOmitAutoCenteredForms specifies whether to skip cascading for autocentered forms.
tnStartTop specifies starting top coordinate.
tnStartLeft specifies starting left coordinate.
GetCurrentTopFormRef method Returns the current frame window. Use primarily for top-level form applications.
Syntax: GetCurrentTopFormReference( )
Return: loTopForm
Arguments: none
IMDIWorkspaceColor_access( ) Syntax: IMDIWorkspaceColor_access( )
Return: GetSysColor(12)
Arguments: none
InvokeMenuItemInFrame method Use to invoke menu items in top-level form applications to access certain system dialog boxes, such as the Find dialog box. Also use to implement a menu item in a dialog box that does not have a menu.
Syntax: InvokeMenuItemInFrame(tcAction)
Return: none
Arguments:
tcAction specifies navigation action such as NEXT or PREVIOUS.
You can also use the following actions: UNDO, REDO, CUT, COPY, PASTE, CLEAR, SELECTALL, FIND, FINDAGAIN, REPLACE
ShowCurrentTopForm method | Internal to the class.
ShowWindowInFrame method | Internal to the class.


Cross Tab (VFP Foundation Class)

Cross Tab

See Also

Category | Automation
Default Catalog | Visual FoxPro Catalog\Foundation Classes\Automation
Class | _xtab
Base Class | Custom
Class Library | _utility.vcx
Parent Class | _custom
Sample | ...\Samples\Vfp98\Solution\OLE\Automate.scx

Remarks

This class uses the the Cross-Tab Wizard engine to generate a cross tab report when placed on a form.

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut menu, select Add to Project or Add to Form. When you add the class to a form in a data environment, Visual FoxPro opens a builder so you can specify the appropriate lDisplayNulls, lTotalRows, nTotalOption, and lBrowseAfter values. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods | Description
cOutfile property | The name of the output file. Default: xtabquery
lCursorOnly property | Specifies whether the input datasource is cursor. Default: .T.
lCloseTable property | Specifies whether to close the source datasource after the cross tab is generated. Default: .T.
lShowThem property | Specifies whether to show thermometer during cross tab generation. Default: .T.
nRowField property | Specifies the field position in the datasource of the cross tab rows. Default: 1
nColField property | Species the field position in the datasource of the cross tab columns. Default: 2
nDataField property | Specifies the field position in the datasource of the cross tab data. Default: 3
lTotalRows property | Specifies whether to total rows in the cross tab output. Default: .F.
nTotalOption property | Specifies the Totaling option to perform 0 = sum 1 = count 2 = % of total. Default: 0
lDisplayNulls property | Specifies whether to display null values in the cross tab output. Default: .F.
lBrowseAfter property | Specifies whether to open a Browse window on the cross tab output. Default: .T.
RunXtab method | Generates a cross tab. Syntax: RunXtab( ) Return: none Arguments: none


Open Dialog Box Flag Values

You can customize the Open dialog box by setting the Flag property to the sum of a selection of the following values:

Value | Description
1 | Causes the Read-Only check box to be initially checked when the dialog box is created. This flag also indicates the state of the Read-Only check box when the dialog box is closed.
2 | Causes the Save As dialog box to generate a message box if the selected file already exists. The user must confirm whether to overwrite the file.
4 | Hides the Read-Only check box.
8 | Forces the dialog box to set the current directory to what it was when the dialog box was opened.
16 | Causes the dialog box to display the Help button.
256 | Specifies that the common dialog box allows invalid characters in the returned file name.
512 | Specifies that the File Name list box allows multiple selections. The user can select more than one file at run time by pressing the SHIFT key and using the UP ARROW and DOWN ARROW keys to select the desired files. When this is done, the File Name property returns a string containing the names of all selected files. The names in the string are delimited by spaces.
1024 | Indicates that the extension of the returned file name is different from the extension specified by the DefaultExt property. This flag isn't set if the DefaultExt property is Null, if the extensions match, or if the file has no extension. This flag value can be checked upon closing the dialog box.
2048 | Specifies that the user can enter only valid paths. If this flag is set and the user enters an invalid path, a warning message is displayed.
4096 | Specifies that the user can enter only names of existing files in the File Name text box. If this flag is set and the user enters an invalid file name, a warning is displayed. This flag automatically sets the 2048 flag.
8192 | Specifies that the dialog box prompts the user to create a file that doesn't currently exist. This flag automatically sets the 4096 and 2048 flags.
16384 | Specifies that sharing violation errors will be ignored.
32768 | Specifies using the Windows 95 Explorer Open A File dialog box template. (Windows 95 only.)
524288 | Use the Explorer Open A File dialog box template. Common dialogs that use this flag do not work under Windows NT using the Windows 95 shell.
1048576 | Do not dereference shell links (also known as shortcuts). By default, choosing a shell link causes it to be dereferenced by the shell.
1048576 | Do not dereference shortcuts (shell links). By default, choosing a shortcut causes it to be dereferenced by the shell. (Windows 95 only.)
2097152 | Allows the user to use long file names. (Windows 95 only.)


Play an AVI File in an ActiveX Control

File: ...\Samples\Vfp98\Solution\OLE\Mmsample.scx

This sample shows how to use the Multimedia control to play an AVI file in a control that has an hWnd property.

The control with the hWnd is a custom ActiveX control called hWin, created with the OLE control wizard in Microsoft Visual C++ 4.0. In creating the hWin .ocx, all the default options in the OLE Control wizard were chosen, all the default properties were added to the control, and the code was compiled.

In the Init of the form, the following line of code directs the Multimedia control to play the AVI in the hWin control (named Test):

ThisForm.VCR.hWndDisplay = ThisForm.Test.hWnd


Print Data Dictionary Information

File: ...\Samples\Vfp98\Solution\Reports\Dbctofrx.scx

This sample illustrates a simple way to generate a report with the contents of a Visual FoxPro database (dbc). Simply pick a .dbc file when prompted and a report will be generated for you to preview. You can click on the Print button to generate a hard copy of it.

The sample creates a temporary cursor and inserts new records as the .dbc is scanned. Table and view records are added along with their associated field and index information.


Print Product Orders By Quarter

File: ...\Samples\Vfp98\Solution\Reports\Ordgraph.scx

This sample illustrates generating and printing graphs on the fly. Visual FoxPro allows you to add graphs to forms as either OleControls or OleBoundControls. The latter representing a graph which is bound to data via a General field.

If you intend to use the Visual FoxPro report writer to print graphs, you need to use General fields to store the graphs. The easiest way to create a new graph in a General field is to use the APPEND GENERAL command, for example:

APPEND GENERAL graphfield CLASS "msgraph"

The example above will create a graph in a General field, however, it won't contain your data. The DATA clause actually passes data to the graph.

The following code loops through records already containing data and constructs a string to pass to the graph with APPEND GENERAL .... DATA:

SCAN NEXT m.totrecs
   m.cData = ""+TAB+m.f2+TAB+m.f3+TAB+m.f4+CRLF+;
      EVAL(fields(1))+ TAB + ;
      ALLTRIM(STR(EVAL(field(2))))+ TAB +;
      ALLTRIM(STR(EVAL(field(3))))+ TAB + ;
      ALLTRIM(STR(EVAL(field(4))))
   m.cDetails = ;

f2+"-" +ALLTRIM(STR(EVAL(FIELD(2)))) ;
      + CRLF + f3+"-" +ALLTRIM(STR(EVAL(FIELD(3)))) ;
      + CRLF + f4+" - "+ALLTRIM(STR(EVAL(FIELD(4)))) +CRLF
   INSERT INTO prodsales ;
VALUES(SalesData.prod_name,tmpgrph.graph,m.cDetails)
   APPEND GENERAL prodsales.sales DATA m.cData
ENDSCAN

Once you have a table or cursor containing a General field with your graphs, you can then print it to a Visual FoxPro report using the REPORT FORM command. You cannot include an ActiveX control in a report.


(Untitled)

See Also

Visual FoxPro Foundation Classes A-Z